@import url("https://fonts.googleapis.com/css2?family=Almarai:wght@400;700;800&family=Tajawal:wght@400;500;700;800&display=swap");

:root {
  color-scheme: light;

  /* ══ نظام التصميم — حضور برو ══
     الهوية: أزرق أساسي (تفاعل وإجراءات) + أخضر كلمسة (شعار/نجاح/مؤشرات)
     الدلالات: نجاح=أخضر، تحذير/تأخر=كهرماني، خطر/غياب=أحمر، معلومة=أزرق */

  /* سلّم الأزرق — العلامة الأساسية */
  --blue-50: #eff5fb;
  --blue-100: #dbe8f6;
  --blue-200: #b9d2ec;
  --blue-300: #8db4dd;
  --blue-400: #5a90c7;
  --blue-500: #2f6cab;
  --blue-600: #14518e;
  --blue-700: #114478;
  --blue-800: #0e3760;
  --blue-900: #0a2845;

  /* سلّم الأخضر — لمسة العلامة + النجاح/الحضور */
  --green-50: #ecf7f1;
  --green-100: #d4eee0;
  --green-200: #a8dcc2;
  --green-300: #74c49d;
  --green-400: #45a878;
  --green-500: #2f9a66;
  --green-600: #228c57;
  --green-700: #1a7044;
  --green-800: #145736;
  --green-900: #0e3f27;

  /* سلّم الكهرماني — التحذير/التأخر */
  --amber-50: #faf3e6;
  --amber-100: #f4e4c8;
  --amber-200: #e8cb95;
  --amber-300: #d9ad5e;
  --amber-400: #c59650;
  --amber-500: #b07e33;
  --amber-600: #9a6a32;
  --amber-700: #7c5326;
  --amber-800: #5e3e1c;

  /* سلّم الأحمر — الخطر/الغياب */
  --red-50: #fcefec;
  --red-100: #f8d9d3;
  --red-200: #efb1a5;
  --red-300: #e08570;
  --red-400: #cc5a42;
  --red-500: #b93424;
  --red-600: #a02b1d;
  --red-700: #822117;

  /* مقياس المسافات (أساس 4px) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* سلّم الخطوط */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: 34px;
  --lh-tight: 1.3;
  --lh-base: 1.65;

  /* الزوايا */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* الظلال — خفيفة هادئة */
  --shadow-1: 0 1px 3px rgba(16, 38, 63, 0.07);
  --shadow-2: 0 2px 10px rgba(16, 38, 63, 0.07);
  --shadow-3: 0 8px 28px rgba(16, 38, 63, 0.13);
  --shadow: var(--shadow-3);
  --shadow-soft: var(--shadow-2);

  /* الحركة */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 160ms;
  --t-slow: 240ms;

  /* حلقة التركيز (وصولية) */
  --focus-ring: 0 0 0 3px rgba(20, 81, 142, 0.25);

  /* ── المتغيرات التشغيلية (مربوطة بالنظام) ── */
  --ice: var(--blue-50);
  --deep-blue: var(--blue-600);
  --mist-blue: #bbc8d8;
  --sand-gold: var(--amber-400);
  --bg: #e6edf4;
  --surface: #f4f7fa;
  --surface-2: #e7eef5;
  --surface-3: #dbe6ee;
  --surface-card: #f7fafc;
  --surface-card-strong: #eef4f8;
  --surface-tint: #eaf1f6;
  --ink: #10263f;
  --muted: #66778a;
  --line: #c8d6e3;
  --brand: var(--blue-600);
  --brand-strong: var(--blue-700);
  --brand-soft: var(--blue-50);
  --blue: var(--blue-600);
  --blue-strong: var(--blue-700);
  --gold: var(--amber-400);
  --gold-strong: var(--amber-600);
  --orange: var(--amber-500);
  --green: var(--green-600);
  --success: var(--green-600);
  --success-soft: var(--green-50);
  --danger: var(--red-500);
  --danger-soft: var(--red-50);
  --warning: var(--amber-600);
  --warning-soft: var(--amber-50);
  --info: var(--blue-600);
  --info-soft: var(--blue-50);
  --slate: #10263f;
  --accent: var(--green-600);
  --gray: #bbc8d8;
  --font-heading: "Almarai", "Segoe UI", system-ui, sans-serif;
  --font-body: "Tajawal", "Almarai", "Segoe UI", system-ui, sans-serif;
  font-family: var(--font-body);

  /* ══ نظام ألوان قسم التقارير المعتمد (تعليمات المستشار §ثانيًا) ══ */
  --rpt-navy: #16324f;              /* كحلي الرأس */
  --rpt-navy-sub: #a8c0d8;          /* نص ثانوي على الكحلي */
  --rpt-blue: var(--blue-700);     /* أزرق المنصة — موحّد مع --brand-strong */
  --rpt-blue-ink: #0c447c;         /* أزرق غامق للنص */
  --rpt-blue-soft: #eaf2fa;        /* خلفية زرقاء باهتة */
  --rpt-gold: #e8a33d;             /* ذهبي زر الطباعة */
  --rpt-gold-ink: #1c2733;         /* نص على الذهبي */
  --rpt-red: #b3382a;              /* غياب */
  --rpt-red-ink: #701f16;
  --rpt-red-soft: #fbeeec;
  --rpt-amber: #9a6a15;            /* تأخر/خروج مبكر */
  --rpt-amber-ink: #5c3d08;
  --rpt-amber-soft: #faf3e4;
  --rpt-green: #1f7a4d;            /* حضور/سلامة */
  --rpt-green-ink: #14532d;
  --rpt-green-soft: #e9f4ee;
  --rpt-line: #e4e9ef;            /* حدود خارجية */
  --rpt-line-in: #eef2f6;         /* حدود داخلية */
  --rpt-line-tight: #f1f4f8;      /* أسطر مضغوطة */
  --rpt-zone: #f6f9fc;            /* خلفية الفلاتر ورؤوس الجداول */
  --rpt-zone-2: #fafbfd;          /* خلفية ثانوية */
  --rpt-ink: #1c2733;            /* نص أساسي */
  --rpt-ink-2: #33475b;         /* نص ثانوي */
  --rpt-ink-mute: #5a6b7c;       /* نص خافت */
  --rpt-ink-hint: #9aa7b4;       /* تلميح */
}

* {
  box-sizing: border-box;
}

/* حجز مكان شريط التمرير دائمًا: يمنع إزاحة التخطيط أفقيًا عند ظهوره واختفائه
   (يظهر جليًا لمن يضبط شريط التمرير على "الإظهار دائمًا") */
html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef3f8 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 800;
}

h1,
h2,
h3,
h4,
.public-brand,
.public-nav,
.nav-item,
.topbar,
.metric,
.panel-header,
.toolbar-field,
th,
.status-pill,
.public-kicker,
.section-heading span,
.data-tab,
.message-tab,
.dashboard-tab {
  font-family: var(--font-heading);
}

p,
td,
textarea,
input,
select,
.student-check span,
.student-chip,
.school-section-card p,
.template-preview p,
.dialog-note {
  font-family: var(--font-body);
}

.hidden {
  display: none !important;
}

.public-site {
  min-height: 100vh;
}

.public-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.public-brand .brand-mark {
  width: 44px;
  height: 44px;
}

.public-brand strong {
  color: var(--brand-strong);
}

.public-brand span {
  color: var(--muted);
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.public-nav a,
.text-link {
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.public-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 54px;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 26px;
  align-items: center;
  min-height: calc(100vh - 98px);
}

.public-hero-copy {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42));
  border: 1px solid rgba(215, 231, 229, 0.8);
  border-radius: 8px;
  padding: 34px;
  box-shadow: var(--shadow-soft);
}

.public-kicker,
.section-heading span,
.plan-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 12px;
  background: linear-gradient(145deg, #fff6df, var(--gold));
  color: #593c16;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.public-hero h1 {
  max-width: 760px;
  margin: 16px 0 14px;
  color: var(--ink);
  font-size: 44px;
  line-height: 1.35;
  letter-spacing: 0;
}

.public-hero p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.public-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.trust-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--brand-strong);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
}

.public-preview {
  border: 2px solid rgba(197, 150, 80, 0.82);
  border-radius: 8px;
  padding: 22px;
  background:
    linear-gradient(160deg, #ffffff 0%, #eef4fa 42%, #dfe8f0 100%);
  box-shadow: var(--shadow);
}

.preview-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 92px;
  padding: 20px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(197, 150, 80, 0.65);
}

.preview-top span {
  font-weight: 800;
}

.preview-top strong {
  font-size: 42px;
  line-height: 1;
}

.preview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.preview-cards div,
.preview-list p,
.feature-card,
.price-card,
.faq-grid article {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.preview-cards div {
  min-height: 92px;
  padding: 14px;
  display: grid;
  align-content: center;
}

.preview-cards span {
  color: var(--muted);
  font-size: 12px;
}

.preview-cards strong {
  color: var(--brand-strong);
  font-size: 30px;
}

.preview-list {
  display: grid;
  gap: 10px;
}

.preview-list p {
  margin: 0;
  padding: 13px 14px;
  color: var(--ink);
  font-weight: 700;
}

.preview-list b {
  margin-left: 8px;
}

.public-section {
  padding: 38px 0;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h1,
.section-heading h2 {
  margin: 12px 0 0;
  font-size: 30px;
  line-height: 1.4;
}

.feature-grid,
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.pricing-grid {
  grid-template-columns: repeat(3, 1fr);
}

.feature-card,
.price-card,
.faq-grid article {
  padding: 20px;
}

.feature-card > span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff, var(--brand-soft));
  border: 1px solid rgba(197, 150, 80, 0.72);
  font-size: 26px;
  box-shadow: var(--shadow-soft);
}

.feature-card h3,
.price-card h3,
.faq-grid h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.feature-card p,
.price-card p,
.faq-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.price-card {
  display: grid;
  gap: 14px;
}

.price-card strong {
  color: var(--brand-strong);
  font-size: 24px;
}

.price-card.featured {
  border-color: rgba(197, 150, 80, 0.95);
  background: linear-gradient(145deg, #ffffff, #eef4fa);
  transform: translateY(-8px);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.setup-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.setup-card {
  width: min(980px, 100%);
  border: 2px solid rgba(197, 150, 80, 0.78);
  border-radius: 8px;
  padding: 26px;
  background: linear-gradient(145deg, #ffffff, #f3f7fb);
  box-shadow: var(--shadow);
}

.setup-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.setup-form label,
.setup-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.setup-form button,
.setup-checklist,
.setup-section {
  grid-column: 1 / -1;
}

.setup-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 22px rgba(16, 38, 63, 0.06);
}

.setup-section-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.setup-section-title > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--brand-strong), var(--slate));
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(16, 38, 63, 0.12);
}

.setup-section-title h2,
.setup-section-title p {
  margin: 0;
}

.setup-section-title h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}

.setup-section-title p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.setup-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stage-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.setup-choice {
  min-height: 54px;
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink) !important;
}

.setup-choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-strong);
}

.setup-choice:has(input:checked) {
  border-color: rgba(20, 81, 142, 0.46);
  background: linear-gradient(145deg, #ffffff, var(--brand-soft));
  box-shadow: inset 0 0 0 1px rgba(20, 81, 142, 0.08);
}

.naming-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.naming-mode strong {
  color: var(--ink);
  margin-left: 6px;
}

.naming-mode label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.naming-mode input {
  accent-color: var(--brand-strong);
}

.grade-builder {
  display: grid;
  gap: 10px;
}

.grade-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(190px, auto);
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.grade-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
}

.grade-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-strong);
}

.grade-row.disabled {
  opacity: 0.62;
}

.grade-counter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.grade-counter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.grade-counter input {
  width: 82px;
  min-height: 40px;
  text-align: center;
}

.setup-preview {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(197, 150, 80, 0.42);
  background: #f8fbfe;
  color: var(--blue-strong);
  font-size: 13px;
  line-height: 1.7;
}

.setup-checklist {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0;
}

.setup-checklist div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.setup-checklist span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--green), var(--brand));
  font-weight: 800;
}

.dialog-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* عدّاد حروف سبب الغياب في بوابة ولي الأمر */
.excuse-counter {
  margin: -6px 0 0;
  text-align: start;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.excuse-counter.is-near-limit { color: #b07d1e; }
[data-theme="dark"] .excuse-counter.is-near-limit { color: #dcb16a; }

.sidebar-link {
  width: 100%;
  margin-top: 12px;
  min-height: 38px;
  border: 1px solid rgba(197, 150, 80, 0.38);
  border-radius: 8px;
  background: rgba(234, 239, 243, 0.08);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 306px 1fr;
}

.mobile-scrim {
  display: none;
}

.sidebar {
  background:
    radial-gradient(circle at 18% 8%, rgba(197, 150, 80, 0.18) 0 78px, transparent 190px),
    linear-gradient(180deg, #14518e 0%, #114a80 42%, #10263f 100%);
  color: #ffffff;
  padding: 22px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(234, 239, 243, 0.14);
  box-shadow: -18px 0 46px rgba(16, 38, 63, 0.16);
  overflow-y: auto;
  scrollbar-color: rgba(197, 150, 80, 0.5) rgba(234, 239, 243, 0.08);
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(234, 239, 243, 0.08);
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(197, 150, 80, 0.48);
}

.brand {
  min-height: 86px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid rgba(234, 239, 243, 0.14);
  border-radius: 8px;
  background: rgba(234, 239, 243, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, #ffffff 0%, #eaeff3 100%);
  color: var(--brand-strong);
  font-weight: 900;
  font-size: 28px;
  box-shadow:
    inset 0 0 0 3px rgba(197, 150, 80, 0.62),
    0 11px 20px rgba(16, 38, 63, 0.18);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 21px;
  line-height: 1.2;
  font-weight: 800;
}

.brand span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}

.brand small {
  align-self: start;
  border: 1px solid rgba(197, 150, 80, 0.55);
  border-radius: 999px;
  padding: 3px 8px;
  color: #eaeff3;
  background: rgba(197, 150, 80, 0.12);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 800;
}

.nav-group-label {
  margin: 0 10px 8px;
  color: rgba(234, 239, 243, 0.58);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 800;
}

.nav-group-secondary {
  margin-top: 16px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  text-align: right;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  position: relative;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  background:
    linear-gradient(90deg, rgba(234, 239, 243, 0.18), rgba(234, 239, 243, 0.08));
  color: #ffffff;
  transform: translateX(-3px);
  border-color: rgba(234, 239, 243, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 8px;
  width: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(197, 150, 80, 0.12);
}

.nav-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(248, 251, 253, 0.95) 0%, #dce8f1 100%);
  color: var(--brand-strong);
  font-size: 16px;
  font-weight: 800;
  border: 1px solid rgba(197, 150, 80, 0.5);
  box-shadow: 0 8px 18px rgba(16, 38, 63, 0.16);
}

.nav-item.active .nav-icon {
  background: linear-gradient(145deg, #ffffff 0%, #e1c18a 100%);
  color: var(--slate);
  border-color: rgba(197, 150, 80, 0.78);
}

.sidebar-footer {
  margin-top: auto;
  border: 1px solid rgba(234, 239, 243, 0.14);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(234, 239, 243, 0.12), rgba(234, 239, 243, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar-footer span,
.sidebar-footer strong {
  display: block;
}

.sidebar-footer span {
  color: rgba(234, 239, 243, 0.62);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 5px;
}

.sidebar-footer strong {
  font-size: 14px;
  line-height: 1.5;
}

.main {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 20px 26px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(115deg, var(--blue-800) 0%, var(--blue-600) 52%, var(--blue-500) 100%);
  box-shadow: 0 10px 28px rgba(10, 40, 69, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.10);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  inset-block: -40%;
  inset-inline-start: -8%;
  width: 220px;
  background: radial-gradient(closest-side, rgba(34, 140, 87, 0.30), rgba(34, 140, 87, 0) 72%);
  pointer-events: none;
}

.main {
  background:
    linear-gradient(180deg, rgba(234, 241, 246, 0.72), rgba(221, 231, 240, 0.36));
}

.topbar-heading {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: -0.3px;
  font-weight: 800;
  color: #fff;
}

/* اسم المدرسة — شارة برّاند واضحة */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 6px 14px 6px 7px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  max-width: 100%;
}

.school-badge {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--blue-700);
  box-shadow: 0 2px 6px rgba(10, 40, 69, 0.28);
}

.school-badge svg {
  width: 18px;
  height: 18px;
}

.school-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

/* بطاقة التاريخ — مميزة بلون مختلف */
.date-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px 9px 13px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 16px rgba(10, 40, 69, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.date-card__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-50);
  color: var(--green-600);
}

.date-card__icon svg {
  width: 21px;
  height: 21px;
}

.date-card__body {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

/* البطاقة بيضاء دائمًا (فوق الشريط الأزرق) — نثبّت ألوان النص داكنة في الوضعين */
.date-card__label {
  font-size: 11px;
  font-weight: 700;
  color: #1a7044;
  margin-bottom: 2px;
}

.date-card__value {
  font-size: 14.5px;
  font-weight: 800;
  color: #10263f;
  white-space: nowrap;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #f8fbfd, #e4edf5);
  color: var(--brand-strong);
  font-size: 20px;
  box-shadow: var(--shadow-soft), inset 0 0 0 2px rgba(197, 150, 80, 0.52);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-band {
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #edf4f8 0%, #dfeaf2 42%, #ccdce8 100%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-band::after {
  content: "";
  position: absolute;
  inset: auto -34px -60px auto;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(187, 200, 216, 0.18);
}

.hero-illustration {
  width: 98px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, #f7fafc 0%, #dfeaf2 100%);
  border: 2px solid rgba(197, 150, 80, 0.82);
  box-shadow: var(--shadow-soft);
  position: relative;
  z-index: 1;
}

.manager-avatar {
  width: 66px;
  height: 86px;
  position: relative;
}

.manager-avatar .head {
  position: absolute;
  left: 16px;
  top: 7px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd7ac, #c98149);
  box-shadow: 0 -8px 0 7px #ffffff, 0 -10px 0 8px #222;
}

.manager-avatar .body {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 46px;
  border-radius: 24px 24px 10px 10px;
  background: linear-gradient(180deg, #f8fbfd, #d6e5ee);
  border: 1px solid #c6dbe2;
}

.hero-band p,
.hero-band h2 {
  margin: 0;
}

.hero-band p {
  color: var(--blue-strong);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.hero-band h2 {
  font-size: 26px;
  line-height: 1.35;
  letter-spacing: 0;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.9);
}

.hero-stamp {
  min-width: 170px;
  border: 2px solid rgba(197, 150, 80, 0.78);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(145deg, #f7fafc 0%, #dfeaf2 100%);
  box-shadow: var(--shadow-soft);
  position: relative;
  z-index: 1;
}

.stamp-icon {
  position: absolute;
  top: -18px;
  left: 14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green), var(--brand-strong));
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-soft);
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.hero-stamp span,
.hero-stamp strong {
  display: block;
}

.hero-stamp span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hero-stamp .stamp-icon {
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
  line-height: 44px;
  text-align: center;
}

.hero-stamp strong {
  margin-top: 8px;
  color: var(--brand-strong);
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 124px;
  background:
    linear-gradient(145deg, #f7fafc 0%, #e9f1f7 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(16, 38, 63, 0.075);
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: linear-gradient(180deg, var(--green), var(--brand));
}

.metric::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(20, 81, 142, 0.07);
}

.metric-icon {
  position: absolute;
  top: 15px;
  left: 16px;
  z-index: 1;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #f9fbfd 0%, #e8f0f6 100%);
  border: 1px solid rgba(197, 150, 80, 0.72);
  box-shadow: 0 8px 14px rgba(16, 38, 63, 0.1);
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 800;
}

.metric strong {
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
}

.metric.danger::before {
  background: linear-gradient(180deg, #d8a55c, var(--orange));
}

.metric.warning::before {
  background: linear-gradient(180deg, var(--gold), var(--warning));
}

.metric.info::before {
  background: linear-gradient(180deg, #b6b8b9, var(--gray));
}

.metric.success::before {
  background: linear-gradient(180deg, #7fa7c7, var(--green));
}

.metric.neutral::before {
  background: linear-gradient(180deg, var(--gold), var(--gold-strong));
}

.metric.danger strong {
  color: var(--danger);
}

.metric.warning strong {
  color: var(--warning);
}

.metric.info strong {
  color: var(--gray);
}

.metric.success strong {
  color: var(--green);
}

.metric.neutral strong {
  color: var(--gold-strong);
}

.dashboard-control-panel {
  margin-bottom: 16px;
}

.daily-progress {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #f7fafc, #dfeaf2);
}

.daily-progress strong,
.daily-progress span {
  display: block;
}

.daily-progress strong {
  color: var(--brand-strong);
  font-size: 28px;
  line-height: 1;
}

.daily-progress span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4edf5;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--brand), var(--blue));
  transition: width 180ms ease;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface-card);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-tab.active {
  background: linear-gradient(180deg, var(--green) 0%, var(--brand-strong) 100%);
  color: #ffffff;
  border-color: rgba(197, 150, 80, 0.72);
  box-shadow: var(--shadow-soft);
}

.dashboard-tab-panel {
  display: none;
  margin-bottom: 18px;
}

.dashboard-tab-panel.active {
  display: block;
}

.section-status-grid,
.pending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.section-status-card,
.pending-card,
.absence-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #f7fafc, #e7f0f6);
  box-shadow: var(--shadow-soft);
}

.section-status-card {
  padding: 15px;
  position: relative;
  overflow: hidden;
}

.section-status-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: linear-gradient(180deg, var(--green), var(--brand));
}

.section-status-card.pending::before {
  background: linear-gradient(180deg, var(--gold), var(--warning));
}

.section-status-card.has-absence::before {
  background: linear-gradient(180deg, #b86b4b, var(--danger));
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.section-card-header h3 {
  margin: 0;
  font-size: 18px;
}

.section-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.section-card-stats div {
  min-height: 62px;
  display: grid;
  align-content: center;
  padding: 9px;
  border-radius: 8px;
  background: #f4f8fc;
}

.section-card-stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.section-card-stats strong {
  color: var(--brand-strong);
  font-size: 22px;
  line-height: 1.1;
}

.section-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mini-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--brand-strong);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.absence-groups {
  display: grid;
  gap: 12px;
}

.absence-group {
  padding: 14px;
}

.absence-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.absence-group-header h3 {
  margin: 0;
  font-size: 17px;
}

.student-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.student-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid #f0d0c8;
  background: #fff4ef;
  color: #7d201a;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.pending-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.pending-card h3,
.pending-card p {
  margin: 0;
}

.pending-card h3 {
  font-size: 17px;
}

.pending-card p {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-events-panel {
  margin-top: 4px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.dashboard-hero-copy,
.dashboard-score-card {
  border: 1px solid rgba(191, 230, 223, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.dashboard-hero-copy {
  min-height: 196px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(20, 81, 142, 0.96) 0%, rgba(16, 38, 63, 0.9) 100%);
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.dashboard-hero-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(197, 150, 80, 0.24) 0 2px, transparent 2px 68px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 68px);
  opacity: 0.38;
}

.dashboard-hero-copy::after {
  content: "✓";
  position: absolute;
  bottom: -48px;
  left: 24px;
  color: rgba(255, 255, 255, 0.1);
  font-size: 178px;
  line-height: 1;
  font-weight: 800;
}

.dashboard-hero-copy > * {
  position: relative;
  z-index: 1;
}

.dashboard-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: var(--r-full);
  padding: 4px 12px;
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-200);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.dashboard-hero h2,
.dashboard-hero p {
  margin: 0;
}

.dashboard-hero h2 {
  max-width: 720px;
  margin-top: 18px;
  font-size: 32px;
  line-height: 1.35;
  font-weight: 800;
}

.dashboard-hero p {
  max-width: 760px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 1.8;
}

.dashboard-score-card {
  min-height: 196px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 20px;
  background:
    linear-gradient(180deg, #ffffff 0%, #eaeff3 100%);
}

.score-ring {
  --score: 0deg;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 56%, transparent 57%),
    conic-gradient(var(--brand) 0 var(--score), #d8e2eb var(--score) 360deg);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-soft);
}

.score-ring span {
  color: var(--brand-strong);
  font-size: 29px;
  line-height: 1;
  font-weight: 800;
}

.dashboard-score-card div:last-child {
  text-align: center;
}

.dashboard-score-card span,
.dashboard-score-card strong {
  display: block;
}

.dashboard-score-card div:last-child span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-score-card div:last-child strong {
  color: var(--brand-strong);
  font-size: 15px;
  line-height: 1.5;
}

#dashboardView .metrics-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

#dashboardView .metric {
  min-height: 132px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 12px;
  row-gap: 8px;
  align-items: start;
  padding: 14px;
  border-color: rgba(221, 214, 201, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(234, 239, 243, 0.44) 100%);
  box-shadow: 0 12px 24px rgba(16, 38, 63, 0.08);
}

#dashboardView .metric::before {
  width: 4px;
}

#dashboardView .metric::after {
  display: none;
}

#dashboardView .metric-icon {
  position: static;
  grid-column: 1;
  grid-row: 1;
  width: 44px;
  height: 44px;
  color: var(--brand-strong);
  box-shadow: 0 8px 16px rgba(16, 38, 63, 0.08);
}

#dashboardView .metric span {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-height: 0;
  margin: 0;
  color: var(--blue-strong);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dashboardView .metric strong {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: end;
  justify-self: center;
  color: var(--slate);
  font-size: 38px;
  line-height: 1;
  text-align: center;
}

.metric-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#dashboardView .metric.danger .metric-icon,
#dashboardView .metric.warning .metric-icon,
#dashboardView .metric.neutral .metric-icon {
  color: var(--gold-strong);
}

#dashboardView .metric.success .metric-icon,
#dashboardView .metric.info .metric-icon {
  color: var(--brand-strong);
}

.recording-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.52fr) minmax(180px, 0.52fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 18px;
}

.recording-summary-copy,
.recording-card {
  border: 1px solid rgba(221, 214, 201, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 24px rgba(16, 38, 63, 0.07);
}

.recording-summary-copy {
  min-height: 94px;
  display: grid;
  align-content: center;
  padding: 16px 18px;
  background:
    linear-gradient(135deg, rgba(20, 81, 142, 0.96) 0%, rgba(16, 38, 63, 0.9) 100%);
  color: #ffffff;
}

.recording-summary-copy span,
.recording-summary-copy strong {
  display: block;
}

.recording-summary-copy span {
  color: rgba(234, 239, 243, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.recording-summary-copy strong {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.55;
}

.recording-card {
  min-height: 94px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.recording-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
}

.recording-card.pending::before {
  background: var(--gold);
}

.recording-card .metric-icon {
  position: static;
  width: 44px;
  height: 44px;
  color: var(--brand-strong);
}

.recording-card.pending .metric-icon {
  color: var(--gold-strong);
}

.recording-card span {
  color: var(--blue-strong);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.recording-card strong {
  color: var(--slate);
  font-size: 34px;
  line-height: 1;
}

.dashboard-control-panel {
  background:
    linear-gradient(145deg, rgba(244, 248, 251, 0.96), rgba(224, 236, 245, 0.96));
}

#dashboardView .panel-header select {
  min-width: 210px;
}

.daily-progress {
  grid-template-columns: 86px minmax(0, 1fr);
  padding: 16px;
  border-color: rgba(191, 230, 223, 0.95);
  background:
    linear-gradient(135deg, #f5f9fc 0%, #e1edf5 100%);
}

.progress-orb {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff6de, #e7f0f6);
  border: 1px solid rgba(197, 150, 80, 0.68);
  box-shadow: var(--shadow-soft);
}

.daily-progress .progress-orb strong {
  margin: 0;
  color: var(--brand-strong);
  font-size: 24px;
}

.progress-content {
  display: grid;
  gap: 9px;
}

.progress-content span {
  margin: 0;
  color: var(--brand-strong);
  font-size: 13px;
}

.progress-track {
  height: 12px;
  background: #dfe8f0;
}

.dashboard-tabs {
  padding: 5px;
  border-radius: 8px;
  background: #dfeaf2;
  border: 1px solid var(--line);
}

.dashboard-tab {
  flex: 1 1 150px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.dashboard-tab.active {
  background: #f7fafc;
  color: var(--brand-strong);
  border-color: rgba(197, 150, 80, 0.72);
}

#dashboardView .section-status-grid,
#dashboardView .pending-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.section-status-card,
.pending-card,
.absence-group {
  box-shadow: 0 13px 24px rgba(16, 38, 63, 0.1);
}

.section-status-card {
  padding: 16px;
  background:
    linear-gradient(180deg, #f7fafc 0%, #e7f0f6 100%);
}

.section-status-card::before {
  width: 5px;
}

.section-card-header {
  align-items: center;
}

.section-card-header h3 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.section-card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-card-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf5;
  margin-bottom: 12px;
}

.section-card-meter span {
  display: block;
  min-width: 3px;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--danger));
}

.section-status-card:not(.has-absence) .section-card-meter span {
  background: linear-gradient(90deg, var(--green), var(--brand));
}

.section-status-card.pending .section-card-meter span {
  width: 0 !important;
}

.section-card-stats div {
  min-height: 66px;
  background: #dde8f1;
  border: 1px solid var(--line);
}

.section-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.mini-button {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.mini-button:hover {
  transform: translateY(-1px);
  border-color: rgba(3, 155, 141, 0.42);
  box-shadow: 0 7px 14px rgba(16, 38, 63, 0.1);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
}

.panel {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: var(--sp-5);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h2,
.panel p {
  margin: 0;
}

.panel h2 {
  font-size: 18px;
  line-height: 1.45;
  font-weight: 800;
}

.panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: end;
  margin-bottom: var(--sp-4);
}

.toolbar-field {
  flex: 1;
  min-width: 220px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
}

/* ══ شاشة الرصد: بطاقتا التحكم (تاريخ + صف) — تصميم مميّز ══ */
.attendance-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.rec-control {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}

.rec-control:focus-within {
  box-shadow: var(--focus-ring);
}

.rec-control-ic {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: #fff;
}

.rec-control-ic svg {
  width: 21px;
  height: 21px;
}

.rec-control-body {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.rec-control-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-control input,
.rec-control select {
  width: 100%;
  min-height: 0;
  height: auto;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  box-shadow: none;
  text-overflow: ellipsis;
}

.rec-control input:focus,
.rec-control select:focus {
  box-shadow: none;
}

.rec-control input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

.rec-control input[type="date"]::-webkit-date-and-time-value {
  margin: 0;
  text-align: start;
}

.rec-control input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}

/* تمييز بطاقة التاريخ (أزرق) */
.rec-control--date {
  background: var(--blue-50);
  border-color: var(--blue-200);
}
.rec-control--date:focus-within {
  border-color: var(--blue-400);
}
.rec-control--date .rec-control-ic {
  background: var(--blue-600);
}
.rec-control--date .rec-control-label {
  color: var(--blue-700);
}

/* تمييز بطاقة الصف (أخضر) */
.rec-control--class {
  background: var(--green-50);
  border-color: var(--green-200);
}
.rec-control--class:focus-within {
  border-color: var(--green-600);
}
.rec-control--class .rec-control-ic {
  background: var(--green-600);
}
.rec-control--class .rec-control-label {
  color: var(--green-700);
}

/* البطاقتان متجاورتان دائمًا — الجوال والكمبيوتر */

/* بطاقة الصف كزرّ يفتح المنتقي المخصّص */
button.rec-control {
  text-align: start;
  font-family: var(--font-body);
}

.rec-control-value {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-control-caret {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--green-700);
}

.rec-control-caret svg {
  width: 18px;
  height: 18px;
}

/* ══ منتقي الصف المخصّص (ورقة سفلية / بطاقة) ══ */
.picker-dialog {
  width: min(440px, calc(100vw - 28px));
  max-height: 72vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  background: var(--surface-card);
}

.picker-dialog::backdrop {
  background: rgba(10, 40, 69, 0.45);
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.picker-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--ink);
}

.picker-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
}

.picker-close svg {
  width: 18px;
  height: 18px;
}

.picker-list {
  overflow-y: auto;
  max-height: calc(72vh - 64px);
  padding: var(--sp-2);
}

.picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

.picker-option + .picker-option {
  margin-top: 2px;
}

.picker-option:hover {
  background: var(--blue-50);
}

.picker-option.is-selected {
  background: var(--green-50);
  border-color: var(--green-200);
  color: var(--green-800);
}

.picker-option-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--green-600);
  opacity: 0;
}

.picker-option.is-selected .picker-option-check {
  opacity: 1;
}

.picker-option-check svg {
  width: 20px;
  height: 20px;
}

.picker-option-label {
  flex: 1;
  min-width: 0;
}

.picker-empty {
  margin: 0;
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ورقة سفلية على الجوال */
@media (max-width: 600px) {
  .picker-dialog {
    width: 100%;
    max-width: 100%;
    margin: auto auto 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
  }
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #f8fbfd;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
  font-weight: 500;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--blue-300);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-400);
  box-shadow: var(--focus-ring);
}

textarea {
  resize: vertical;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  white-space: nowrap;
  transition: background-color var(--t-base) var(--ease), border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), transform var(--t-fast) var(--ease);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: translateY(1px);
}

.primary-button {
  background: var(--blue-600);
  color: #ffffff;
  box-shadow: var(--shadow-1);
}

.primary-button:hover {
  background: var(--blue-700);
  box-shadow: var(--shadow-2);
}

.secondary-button {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-200);
}

.secondary-button:hover {
  background: var(--blue-100);
}

.ghost-button {
  background: rgba(244, 247, 250, 0.55);
  color: var(--brand-strong);
  border-color: var(--line);
}

.ghost-button:hover {
  background: var(--blue-50);
  border-color: var(--blue-300);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 680px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #e3edf5;
  letter-spacing: 0;
}

td {
  color: #1a2c44;
  font-size: 15px;
  line-height: 1.75;
  font-weight: 500;
}

.row-badge {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  margin-left: 9px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--brand), var(--blue-strong));
  border: 2px solid rgba(255, 255, 255, 0.8);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 7px 12px rgba(16, 38, 63, 0.16);
  vertical-align: middle;
}

.row-badge.danger {
  background: linear-gradient(145deg, #d8a55c, var(--orange));
}

.row-badge.warning {
  background: linear-gradient(145deg, var(--gold), var(--orange));
}

.row-badge.info {
  background: linear-gradient(145deg, var(--mist-blue), var(--brand));
}

tbody tr:hover {
  background: #eef5fa;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.4;
  background: linear-gradient(180deg, #f8fbfe, #e6eef6);
  color: var(--brand-strong);
  font-weight: 800;
}

.status-pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-pill.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-pill.success {
  color: var(--brand-strong);
  background: #dfe8f0;
}

.table-action {
  border: 1px solid rgba(197, 150, 80, 0.55);
  background: var(--surface-tint);
  color: var(--brand-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-family: var(--font-heading);
  font-weight: 800;
  cursor: pointer;
}

.table-action:hover {
  border-color: var(--accent);
  background: #ddeaf3;
}

.muted-text {
  color: var(--muted);
  font-weight: 700;
}

td[data-label*="طالب"],
td[data-label*="طالبة"],
td[data-label="الطالب"],
td[data-label="الطالبة"],
td[data-label="اسم الطالب"],
td[data-label="اسم الطالبة"] {
  color: var(--slate);
  font-family: var(--font-body);
  font-size: 15.5px;
  font-weight: 700;
}

.mini-button {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: 0;
}

.student-check span,
.student-chip {
  color: var(--slate);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.65;
}

.toolbar input,
.toolbar select {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(187, 200, 216, 0.82);
}

.toolbar input::placeholder {
  color: #8392a3;
}

.readiness-list {
  display: grid;
  gap: 14px;
}

.readiness-list div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #f7fafc 0%, #e4eef6 100%);
  border: 1px solid #dbe6f0;
  box-shadow: 0 6px 14px rgba(16, 38, 63, 0.06);
}

.readiness-list span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand);
}

.readiness-list .muted-dot {
  background: var(--accent);
}

.student-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0 var(--sp-6);
  border-top: 1px solid var(--line);
}

.no-absence-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--green-200);
  border-radius: var(--r-md);
  background: var(--green-50);
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}

.no-absence-card:hover {
  border-color: var(--green-300);
}

.no-absence-card input {
  width: 22px;
  height: 22px;
  min-height: auto;
  flex-shrink: 0;
  accent-color: var(--green-600);
}

.no-absence-card strong,
.no-absence-card small {
  display: block;
}

.no-absence-card strong {
  color: var(--green-800);
  font-size: var(--fs-base);
}

.no-absence-card small {
  color: var(--green-700);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.student-check {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-3);
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 8px;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

.student-check:hover {
  background: var(--blue-50);
}

.student-check:has(input:checked) {
  background: var(--red-50);
}

.student-check span {
  flex: 1;
  font-weight: 600;
  font-size: var(--fs-base);
}

.student-check:has(input:checked) span {
  color: var(--red-600);
}

.record-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.record-meta:not(:empty) {
  padding: 10px 12px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.student-check input {
  width: 22px;
  height: 22px;
  min-height: auto;
  accent-color: var(--danger);
}

/* ══ شريط دُفعة التأخر ══ */
.late-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2, #f7f8fa);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.late-batch-count {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
}


/* حالة الطالب المحدد للتأخر (أصفر-ذهبي بدلاً من الأحمر) */
.late-student-grid .student-check:has(input:checked) {
  background: #fef5e0;
  border-bottom-color: #e0c060;
}

.late-student-grid .student-check:has(input:checked) span {
  color: #7c5f1a;
  font-weight: 600;
}

.late-student-grid .student-check input {
  accent-color: #b8863f;
}

.late-batch-fields {
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
}

/* ══ الحالة الفارغة الموحّدة ══ */
.empty-state {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-10) var(--sp-5);
  color: var(--muted);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--sp-1);
  border-radius: var(--r-full);
  background: var(--blue-50);
  color: var(--blue-500);
}

.empty-state-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state strong {
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  max-width: 360px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--muted);
}

.empty-state .primary-button,
.empty-state .secondary-button {
  margin-top: var(--sp-2);
}

.table-empty {
  border-bottom: 0 !important;
  padding: 0 !important;
}

/* ══ شريط الإجراء الثابت (قرب المحتوى) ══ */
.record-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin: var(--sp-4) calc(var(--sp-5) * -1) calc(var(--sp-5) * -1);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface-card);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

.record-actions .primary-button {
  min-width: 160px;
}

/* ══ مُنتقي الطالب (بحث + قائمة) — التأخر/الخروج ══ */
.student-picker {
  display: grid;
  gap: var(--sp-2);
}

.student-picker-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
}

.student-picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 40px;
  padding: 6px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--ink);
  text-align: start;
  transition: background-color var(--t-fast) var(--ease);
}

.student-picker-option:last-child {
  border-bottom: 0;
}

.student-picker-option:hover {
  background: var(--blue-50);
}

.student-picker-option.is-selected {
  background: var(--blue-100);
  color: var(--blue-800);
}

.student-picker-option .spo-name {
  flex: 1;
}

.student-picker-option .spo-check {
  flex: 0 0 18px;
  display: inline-flex;
  color: var(--blue-600);
  opacity: 0;
}

.student-picker-option.is-selected .spo-check {
  opacity: 1;
}

.spo-check svg {
  width: 16px;
  height: 16px;
}

.student-picker-empty {
  padding: var(--sp-5);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.form-panel {
  max-width: 860px;
}

#lateView .form-panel,
#leaveView .form-panel {
  max-width: none;
}

.form-actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.form-actions .primary-button {
  min-width: 160px;
}

.settings-school-form {
  display: grid;
  gap: var(--sp-4);
  max-width: 520px;
}

.settings-school-form .primary-button {
  justify-self: start;
  min-width: 180px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.form-grid label,
.dialog-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.wide {
  grid-column: 1 / -1;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.report-card {
  min-height: 190px;
  display: grid;
  align-content: start;
  gap: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   محرك التقارير
   ═══════════════════════════════════════════════════════════════════ */
.reports-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* السمة [hidden] يجب أن تتغلّب على display:flex في عناصر الشريط */
.report-period[hidden],
.report-period-daily[hidden],
.period-custom[hidden] { display: none; }

/* ─── شريط الأدوات العلوي ─────────────────────────────────────────── */
.report-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-preset {
  padding: 7px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.period-preset:hover {
  color: var(--brand-strong);
  background: var(--surface-3);
}

.period-preset.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 1px 6px rgba(20, 81, 142, .25);
}

.period-custom {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-inline-start: var(--sp-2);
}

.period-custom label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.period-custom input[type="date"] {
  padding: 6px 10px;
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}

/* وضع اليوم الواحد (التقرير اليومي) */
.report-period-daily {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.day-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--brand-strong);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s;
}

.day-nav:hover { background: var(--surface-3); }
.day-nav svg { width: 18px; height: 18px; }

.report-period-daily input[type="date"] {
  padding: 7px 12px;
  font-size: var(--fs-base);
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}

/* أدوات عامة يسار الشريط */
.report-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-inline-start: auto;
}

.cal-toggle {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cal-opt {
  padding: 5px 13px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.cal-opt.active {
  color: #fff;
  background: var(--brand);
}

.rpt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.rpt-icon-btn:hover { color: var(--brand-strong); background: var(--surface-3); }
.rpt-icon-btn svg { width: 18px; height: 18px; }
.rpt-icon-btn.is-spinning svg { animation: rpt-spin .7s linear infinite; }
@keyframes rpt-spin { to { transform: rotate(-360deg); } }

/* ─── بطاقات التبويب (rptTabCards) — النظام المعتمد §ثانيًا.1 ──────── */
.report-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--rpt-zone);
  border: 1px solid var(--rpt-line);
  border-radius: 14px;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 15;
  transition: padding .18s ease, box-shadow .18s ease;
}
/* حالة الانكماش عند التمرير: شريط رفيع أيقونة+اسم */
.report-tabs.is-shrunk {
  padding: 3px 6px;
  box-shadow: var(--shadow-1);
}

.report-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 1 0 auto;
  justify-content: center;
  padding: 10px 18px;
  min-height: 44px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--rpt-ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s, padding .18s ease;
}
.report-tabs.is-shrunk .report-tab { padding: 6px 14px; min-height: 34px; }

.report-tab svg { width: 17px; height: 17px; opacity: .85; }
.report-tab:hover:not(.active):not([disabled]) { color: var(--rpt-blue-ink); background: var(--rpt-blue-soft); }

.report-tab.active {
  color: #fff;
  background: var(--rpt-blue);
  border-color: var(--rpt-blue);
  box-shadow: 0 1px 6px rgba(37, 99, 168, .28);
}

/* تبويب "قريبًا" المعطّل (الخطابات) */
.report-tab--soon { color: var(--rpt-ink-hint); cursor: not-allowed; opacity: .75; }
.report-tab--soon:hover { background: transparent; }
.report-tab-soon {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--rpt-line-in);
  color: var(--rpt-ink-mute);
}

/* ─── مكوّن الرأس الكحلي (rptNavyHeader) ──────────────────────────── */
.rpt-navy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: 16px 20px;
  margin-bottom: var(--sp-4);
  background: var(--rpt-navy);
  border-radius: 14px;
  color: #fff;
}
.rpt-navy-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rpt-navy-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  color: #fff;
}
.rpt-navy-icon svg { width: 22px; height: 22px; }
.rpt-navy-title { margin: 0; font-size: var(--fs-lg); font-weight: 800; color: #fff; }
.rpt-navy-trust {
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--rpt-navy-sub);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.rpt-navy-trust .rpt-trust-sep { opacity: .5; }
.rpt-navy-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── مكوّن بطاقة المؤشر (rptKpiCard) ─────────────────────────────── */
.rpt-kpicard {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--rpt-line);
  background: var(--rpt-zone-2);
}
.rpt-kpicard-top { display: flex; align-items: center; gap: 10px; }
.rpt-kpicard-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 8px; color: #fff;
}
.rpt-kpicard-ic svg { width: 16px; height: 16px; }
.rpt-kpicard-value { font-size: 23px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rpt-kpicard-label { margin-top: 8px; font-size: var(--fs-xs); color: var(--rpt-ink-mute); font-weight: 600; }
.rpt-kpicard-sub { margin-top: 3px; font-size: 11px; color: var(--rpt-ink-hint); font-variant-numeric: tabular-nums; }
/* العائلات اللونية */
.rpt-kpicard--red   { background: var(--rpt-red-soft); }
.rpt-kpicard--red   .rpt-kpicard-ic { background: var(--rpt-red); }
.rpt-kpicard--red   .rpt-kpicard-value { color: var(--rpt-red-ink); }
.rpt-kpicard--amber { background: var(--rpt-amber-soft); }
.rpt-kpicard--amber .rpt-kpicard-ic { background: var(--rpt-amber); }
.rpt-kpicard--amber .rpt-kpicard-value { color: var(--rpt-amber-ink); }
.rpt-kpicard--green { background: var(--rpt-green-soft); }
.rpt-kpicard--green .rpt-kpicard-ic { background: var(--rpt-green); }
.rpt-kpicard--green .rpt-kpicard-value { color: var(--rpt-green-ink); }
.rpt-kpicard--blue  { background: var(--rpt-blue-soft); }
.rpt-kpicard--blue  .rpt-kpicard-ic { background: var(--rpt-blue); }
.rpt-kpicard--blue  .rpt-kpicard-value { color: var(--rpt-blue-ink); }
.rpt-kpicard--navy  { background: var(--rpt-zone); }
.rpt-kpicard--navy  .rpt-kpicard-ic { background: var(--rpt-navy); }
.rpt-kpicard--navy  .rpt-kpicard-value { color: var(--rpt-navy); }

/* ─── مكوّن شريط الفلاتر (rptFilterBar) ───────────────────────────── */
.rpt-filterbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: 12px 14px;
  margin-bottom: var(--sp-4);
  background: var(--rpt-zone);
  border: 1px solid var(--rpt-line);
  border-radius: 12px;
}

/* ─── عناصر التقرير اليومي (المرحلة 1) ────────────────────────────── */
/* شارة اكتمال الرصد داخل سطر الثقة */
.rpt-complete { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.rpt-complete .rpt-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rpt-complete--ok   { color: #7fdca9; }
.rpt-complete--warn { color: #f0c674; }

/* أسهم تنقّل اليوم + منتقي التاريخ في الرأس الكحلي */
.rpt-day-nav {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 9px; cursor: pointer;
  transition: background .15s;
}
.rpt-day-nav:hover:not([disabled]) { background: rgba(255,255,255,.22); }
.rpt-day-nav[disabled] { opacity: .38; cursor: not-allowed; }
.rpt-day-nav svg { width: 18px; height: 18px; }
.rpt-day-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 9px; cursor: pointer;
}
.rpt-day-pick svg { width: 16px; height: 16px; }
.rpt-day-pick input[type="date"] {
  background: transparent; border: none; color: #fff;
  font-size: var(--fs-sm); font-family: inherit; cursor: pointer;
  color-scheme: dark;
}

/* شرائح فلتر الحالة بعدّاد */
.rpt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rpt-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; min-height: 40px;
  font-size: var(--fs-sm); font-weight: 700;
  color: var(--rpt-ink-2);
  background: #fff;
  border: 1px solid var(--rpt-line);
  border-radius: 10px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.rpt-chip-count {
  font-size: var(--fs-xs); font-weight: 800;
  padding: 1px 7px; border-radius: 999px;
  background: var(--rpt-line-in); color: var(--rpt-ink-mute);
  font-variant-numeric: tabular-nums;
}
.rpt-chip:hover { border-color: var(--rpt-ink-hint); }
/* الشريحة النشطة مصمتة بلون حالتها */
.rpt-chip--absent.active { background: var(--rpt-red);   color: #fff; border-color: var(--rpt-red); }
.rpt-chip--late.active   { background: var(--rpt-amber); color: #fff; border-color: var(--rpt-amber); }
.rpt-chip--leave.active  { background: var(--rpt-amber); color: #fff; border-color: var(--rpt-amber); }
.rpt-chip--all.active    { background: var(--rpt-blue);  color: #fff; border-color: var(--rpt-blue); }
.rpt-chip.active .rpt-chip-count { background: rgba(255,255,255,.28); color: #fff; }

.rpt-select {
  padding: 8px 12px; min-height: 40px;
  font-size: var(--fs-sm); font-family: inherit;
  color: var(--rpt-ink); background: #fff;
  border: 1px solid var(--rpt-line); border-radius: 10px;
  margin-inline-start: auto;
}

/* خلية فرعية تحت اسم الطالب (الفصل) */
.rpt-sub-cell { display: block; font-size: 11px; color: var(--rpt-ink-hint); margin-top: 2px; }

/* رصيد الغياب: رقم + شريط نسبي رفيع */
.rpt-bal { display: inline-flex; align-items: center; gap: 8px; }
.rpt-bal-num { font-weight: 800; min-width: 18px; font-variant-numeric: tabular-nums; }
.rpt-bar {
  display: inline-block; width: 68px; height: 5px;
  background: var(--rpt-line-in); border-radius: 999px; overflow: hidden;
}
.rpt-bar-fill { display: block; height: 100%; border-radius: 999px; }
.rpt-bar-fill--green { background: var(--rpt-green); }
.rpt-bar-fill--amber { background: var(--rpt-amber); }
.rpt-bar-fill--red   { background: var(--rpt-red); }

/* زر رابط نصي داخل بطاقة المؤشر */
.rpt-linkbtn {
  background: none; border: none; padding: 0;
  color: var(--rpt-amber-ink); font: inherit; font-weight: 700;
  text-decoration: underline; cursor: pointer;
}

/* ─── لوحات المحتوى ───────────────────────────────────────────────── */
/* ارتفاع أدنى يبقي الصفحة قابلة للتمرير بما يكفي لبقاء شريط التبويبات ملتصقًا
   عند التبديل — بدونه ينهار الارتفاع فيقصّ المتصفح التمرير فجأة */
.report-panels { min-height: calc(100vh - 72px); }

.report-panel { display: none; }
.report-panel.active { display: block; animation: rpt-fade .25s ease; }
@keyframes rpt-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* أدوات خاصة بالتبويب (فلتر فصل / بحث طالب) */
.panel-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

/* ─── عناصر تبويب البيانات الإحصائية (المرحلة 2) ──────────────────── */
/* منتقي الفترة المقسّم داخل الرأس الكحلي */
.rpt-seg-group { display: inline-flex; background: rgba(255,255,255,.1); border-radius: 10px; padding: 3px; gap: 2px; }
.rpt-seg {
  padding: 7px 12px; font-size: var(--fs-xs); font-weight: 700;
  color: var(--rpt-navy-sub); background: transparent;
  border: none; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.rpt-seg.active { background: #fff; color: var(--rpt-navy); }

/* عناوين المقاطع */
.rpt-section-label { font-size: var(--fs-md); font-weight: 800; color: var(--rpt-ink); margin: 6px 2px 12px; }
.rpt-section-hint { font-size: var(--fs-xs); font-weight: 500; color: var(--rpt-ink-hint); margin-inline-start: 8px; }

/* صف القوائم الثلاث */
.rpt-declist-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.rpt-declist {
  background: var(--rpt-zone-2); border: 1px solid var(--rpt-line);
  border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
}
.rpt-declist-head { padding: 10px 14px; font-size: var(--fs-sm); font-weight: 800; }
.rpt-declist--absence   .rpt-declist-head { background: var(--rpt-red-soft);   color: var(--rpt-red-ink); }
.rpt-declist--tardiness .rpt-declist-head { background: var(--rpt-amber-soft); color: var(--rpt-amber-ink); }
.rpt-declist--leave     .rpt-declist-head { background: var(--rpt-blue-soft);  color: var(--rpt-blue-ink); }
.rpt-declist-body { list-style: none; margin: 0; padding: 4px 0; flex: 1; }
.rpt-declist-body li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; min-height: 22px; font-size: 11px;
}
.rpt-declist-rank { width: 18px; text-align: center; font-weight: 800; color: var(--rpt-ink-hint); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.rpt-declist-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.rpt-declist-sec { color: var(--rpt-ink-hint); white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.rpt-declist-val { font-weight: 800; color: var(--rpt-ink-2); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.rpt-declist-empty { color: var(--rpt-ink-hint); justify-content: center; }
.rpt-showfull {
  padding: 8px; font-size: var(--fs-xs); font-weight: 700;
  color: var(--rpt-blue-ink); background: transparent;
  border: none; border-top: 1px solid var(--rpt-line-in); cursor: pointer;
}
.rpt-showfull:hover { background: var(--rpt-blue-soft); }
/* قوائم الفصول */
.rpt-seclist-li { gap: 6px; }
.rpt-seclist-bar { width: 46px; flex-shrink: 0; }
.rpt-seclist-raw { color: var(--rpt-ink-hint); font-weight: 600; }

/* أوجه القائمة الكاملة */
.rpt-facetabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-3); align-items: center; }
.rpt-facetab {
  padding: 7px 14px; font-size: var(--fs-xs); font-weight: 700;
  color: var(--rpt-ink-2); background: var(--rpt-zone);
  border: 1px solid var(--rpt-line); border-radius: 999px; cursor: pointer;
}
.rpt-facetab.active { background: var(--rpt-blue); color: #fff; border-color: var(--rpt-blue); }
.rpt-facetabs .rpt-select { margin-inline-start: auto; }

/* وميض حدّ الجدول عند القفز إليه */
@keyframes rpt-flash-b { 0%,100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 3px var(--rpt-blue); } }
.rpt-flash { animation: rpt-flash-b 2s ease; }

/* ترقيم الصفحات */
.rpt-pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.rpt-page-btn {
  padding: 5px 11px; min-width: 32px; font-size: var(--fs-sm); font-weight: 700;
  color: var(--rpt-ink-2); background: var(--rpt-zone);
  border: 1px solid var(--rpt-line); border-radius: 8px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.rpt-page-btn.active { background: var(--rpt-blue); color: #fff; border-color: var(--rpt-blue); }
.rpt-muted-sm { color: var(--rpt-ink-hint); font-size: var(--fs-sm); }

@media (max-width: 720px) { .rpt-declist-row { grid-template-columns: 1fr; } }

.panel-controls select,
.panel-controls input[type="text"] {
  padding: 8px 12px;
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}

/* ─── بطاقات المؤشرات ─────────────────────────────────────────────── */
.rpt-kpi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.rpt-kpi {
  flex: 1 1 150px;
  padding: var(--sp-4);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.rpt-kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 10px;
}

.rpt-kpi-label svg { width: 15px; height: 15px; }
.rpt-kpi-value { font-size: var(--fs-2xl); font-weight: 800; color: var(--ink); line-height: 1; }
.rpt-kpi-unit { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.rpt-kpi-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }

/* أيقونة مصغّرة داخل البطاقة */
.rpt-kpi-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: var(--brand);
  background: var(--brand-soft);
}
.rpt-kpi-ic svg { width: 14px; height: 14px; }

/* بانر نسبة الانضباط / الحضور — بعرض كامل، لون دلالي */
.rpt-hero-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  color: #fff;
  box-shadow: var(--shadow-2);
  margin-bottom: var(--sp-4);
}
.rpt-hero-banner.disc-good { background: linear-gradient(120deg, var(--green-600), var(--green-800)); }
.rpt-hero-banner.disc-mid  { background: linear-gradient(120deg, var(--amber-500), var(--amber-600)); }
.rpt-hero-banner.disc-low  { background: linear-gradient(120deg, #c0432f, var(--red-500)); }
.rpt-hero-banner .rpt-kpi-ring { flex-shrink: 0; }
.rpt-hero-main .rpt-kpi-label { color: rgba(255,255,255,.85); margin-bottom: 4px; }
.rpt-hero-main .rpt-kpi-value { font-size: var(--fs-3xl); color: #fff; line-height: 1; }
.rpt-hero-main .rpt-kpi-sub   { color: rgba(255,255,255,.82); }

.rpt-hero-breakdown {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-inline-start: var(--sp-5);
}
.rpt-hero-breakdown > div:not(.rpt-hero-div) { text-align: center; min-width: 56px; }
.rpt-hero-breakdown strong { display: block; font-size: var(--fs-xl); font-weight: 800; }
.rpt-hero-breakdown span { font-size: var(--fs-xs); color: rgba(255,255,255,.8); }
.rpt-hero-div { width: 1px; align-self: stretch; min-height: 34px; background: rgba(255,255,255,.28); min-width: 1px; }

.rpt-kpi-ring { flex-shrink: 0; }

/* ─── بطاقات الرسوم والجداول ──────────────────────────────────────── */
.rpt-card {
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  margin-bottom: var(--sp-4);
}

.rpt-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--sp-3);
}
.rpt-card-title svg { width: 18px; height: 18px; color: var(--brand); }
.rpt-card-title .rpt-card-hint { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); margin-inline-start: auto; }

.rpt-charts-2col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.rpt-charts-2col .rpt-card { margin-bottom: 0; }

/* شريط الملاحظات الذكية */
.rpt-insights {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--brand-strong);
  line-height: 1.7;
  margin-bottom: var(--sp-4);
}
.rpt-insights svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }

/* ─── الجداول ─────────────────────────────────────────────────────── */
.rpt-table-wrap { overflow-x: auto; }
.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.rpt-table th {
  padding: 10px 12px;
  text-align: start;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.rpt-table td {
  padding: 11px 12px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.rpt-table tbody tr:last-child td { border-bottom: none; }
.rpt-table tbody tr:hover { background: var(--surface-tint); }
.rpt-table .rpt-rank { color: var(--muted); font-weight: 700; width: 34px; }

/* عنوان فاصل حسب الفصل داخل الجدول */
.rpt-group-row td {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--brand-strong);
  font-size: var(--fs-xs);
}

/* اسم طالب قابل للنقر */
.rpt-student-link {
  color: var(--brand-strong);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: start;
}
.rpt-student-link:hover { text-decoration: underline; }

/* خلية جوال ولي الأمر */
.rpt-phone { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rpt-phone-num { direction: ltr; font-variant-numeric: tabular-nums; color: var(--muted); }
.rpt-phone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.rpt-phone-btn:hover { background: var(--surface-3); }
.rpt-phone-btn svg { width: 14px; height: 14px; }

/* ─── حالة الطالب: نقطة + نص ملوّن، بلا خلفيات (القاعدة 7) ─────────── */
.rpt-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}
.rpt-status .rpt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}
.rpt-status--present { color: var(--rpt-green); }
.rpt-status--absent  { color: var(--rpt-red); }
.rpt-status--late    { color: var(--rpt-amber); }
.rpt-status--leave   { color: var(--rpt-amber); }
.rpt-status--notrec  { color: var(--rpt-ink-hint); }

/* شارة مواظبة صامتة: نقطة لون العتبة فقط، بلا نص */
.rpt-abs-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rpt-abs-mark--green { background: var(--rpt-green); }
.rpt-abs-mark--amber { background: var(--rpt-amber); }
.rpt-abs-mark--red   { background: var(--rpt-red); }

/* حدّ جانبي يمين السطر بلون عتبة الغياب (منطق لون صامت — §ثانيًا.5) */
.rpt-table tbody tr.rpt-row { border-inline-start: 3px solid transparent; }
.rpt-table tbody tr.rpt-row[data-abs="green"] { border-inline-start-color: var(--rpt-green); }
.rpt-table tbody tr.rpt-row[data-abs="amber"] { border-inline-start-color: var(--rpt-amber); }
.rpt-table tbody tr.rpt-row[data-abs="red"]   { border-inline-start-color: var(--rpt-red); }

/* أرقام جدولية موحّدة العرض في كل جداول ومؤشرات التقارير (القاعدة 6) */
.rpt-table td, .rpt-table th,
.rpt-kpi-value, .rpt-hero-breakdown strong, .rpt-phone-num,
.rpt-status { font-variant-numeric: tabular-nums; }

/* ─── تنبيه الرصد الناقص ─────────────────────────────────────────── */
.rpt-warn-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--amber-600);
  line-height: 1.7;
  margin-bottom: var(--sp-4);
}
.rpt-warn-strip svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }

/* ─── بطاقة الطالب ───────────────────────────────────────────────── */
.rpt-student-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-card));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
}
.rpt-student-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  border-radius: 50%;
}
.rpt-student-meta h3 { margin: 0; font-size: var(--fs-lg); color: var(--ink); }
.rpt-student-meta p { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.rpt-student-head .mowatba-badge { margin-inline-start: auto; }

/* صف مطوي للأيام المنتظمة */
.rpt-collapse-row td {
  text-align: center;
  color: var(--brand-strong);
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-tint);
}
.rpt-collapse-row:hover td { background: var(--surface-2); }

/* ─── قائمة بحث الطالب المنسدلة ──────────────────────────────────── */
.rpt-student-search-wrap { position: relative; min-width: 260px; }
.rpt-student-search-wrap input { width: 100%; }
.rpt-student-search-wrap input {
  padding: 9px 14px; font-size: var(--fs-sm); font-family: inherit;
  border: 1px solid var(--rpt-line); border-radius: 10px;
  background: #fff; color: var(--rpt-ink);
}

/* ─── تقرير طالب (المرحلة 3) ──────────────────────────────────────── */
/* الحالة الفارغة */
.rpt-student-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: var(--sp-4); padding: var(--sp-12) var(--sp-4);
}
.rpt-student-empty > svg { width: 48px; height: 48px; color: var(--rpt-ink-hint); }
.rpt-student-empty h3 { margin: 0; font-size: var(--fs-lg); color: var(--rpt-ink); }
.rpt-search-lg { min-width: min(440px, 90%); }
.rpt-search-lg input { padding: 13px 18px; font-size: var(--fs-md); }
.rpt-suggest { margin-top: var(--sp-3); max-width: 640px; }
.rpt-suggest-label { font-size: var(--fs-xs); color: var(--rpt-ink-mute); margin-bottom: 10px; font-weight: 600; }
.rpt-suggest-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rpt-suggest-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; font-size: var(--fs-sm); font-weight: 600;
  color: var(--rpt-blue-ink); background: var(--rpt-blue-soft);
  border: 1px solid var(--rpt-line); border-radius: 999px; cursor: pointer;
}
.rpt-suggest-chip:hover { border-color: var(--rpt-blue); }
.rpt-suggest-chip span {
  font-size: var(--fs-xs); font-weight: 800; padding: 0 6px;
  border-radius: 999px; background: var(--rpt-red); color: #fff;
  font-variant-numeric: tabular-nums;
}

/* بطاقة الهوية (الرأس الكحلي) */
.rpt-idcard {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-3);
  padding: 16px 20px; margin-bottom: var(--sp-4);
  background: var(--rpt-navy); border-radius: 14px; color: #fff;
}
.rpt-idcard-lead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.rpt-idcard-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; flex-shrink: 0;
  font-size: var(--fs-xl); font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--rpt-blue), var(--blue-800));
  border-radius: 50%;
}
.rpt-idcard-meta h2 { margin: 0; font-size: var(--fs-lg); color: #fff; }
.rpt-idcard-sub { margin-top: 3px; font-size: var(--fs-sm); color: var(--rpt-navy-sub); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rpt-idcard-tel { color: #fff; text-decoration: none; font-variant-numeric: tabular-nums; }
.rpt-idcard-tel:hover { text-decoration: underline; }
.rpt-idcard-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rpt-search-sm { min-width: 190px; }
.rpt-search-sm input { padding: 7px 12px; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); color: #fff; }
.rpt-search-sm input::placeholder { color: var(--rpt-navy-sub); }

/* عمودا صفحة الطالب */
.rpt-student-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--sp-4); }
@media (max-width: 860px) { .rpt-student-cols { grid-template-columns: 1fr; } }
.rpt-student-col-side { display: flex; flex-direction: column; gap: var(--sp-4); }

/* سجل الأحداث */
.rpt-events { list-style: none; margin: 0; padding: 0; }
.rpt-event {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 4px; border-bottom: 1px solid var(--rpt-line-tight);
}
.rpt-event:last-child { border-bottom: none; }
.rpt-event .rpt-status { min-width: 92px; }
.rpt-event-date { font-size: var(--fs-xs); color: var(--rpt-ink-mute); font-variant-numeric: tabular-nums; }
.rpt-event-detail { font-size: var(--fs-xs); color: var(--rpt-ink-2); margin-inline-start: auto; }
.rpt-events-foot { margin-top: 10px; font-size: var(--fs-xs); color: var(--rpt-ink-hint); text-align: center; }

/* أعمدة رأسية بسيطة (نمط الأسبوع / الاتجاه الشهري) */
.rpt-vbars { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 6px 4px 0; }
.rpt-vbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.rpt-vbar-track { width: 60%; max-width: 26px; flex: 1; display: flex; align-items: flex-end; background: var(--rpt-line-tight); border-radius: 5px; overflow: hidden; }
.rpt-vbar-fill { width: 100%; background: var(--rpt-red); border-radius: 5px 5px 0 0; min-height: 2px; }
.rpt-vbar-fill--amber { background: var(--rpt-amber); }
.rpt-vbar-num { font-size: 11px; font-weight: 800; color: var(--rpt-ink-2); font-variant-numeric: tabular-nums; }
.rpt-vbar-lbl { font-size: 10px; color: var(--rpt-ink-hint); white-space: nowrap; }
.rpt-warn-inline { margin-top: 10px; padding: 8px 12px; font-size: var(--fs-xs); font-weight: 700; color: var(--rpt-red-ink); background: var(--rpt-red-soft); border-radius: 8px; }
.rpt-print-note { font-size: var(--fs-xs); color: var(--rpt-ink-hint); margin-top: 12px; }

/* ─── اللوحة الجانبية (studentSlideover) ──────────────────────────── */
.rpt-slideover { position: fixed; inset: 0; z-index: 200; visibility: hidden; }
.rpt-slideover.open { visibility: visible; }
.rpt-slideover-scrim { position: absolute; inset: 0; background: rgba(16, 38, 63, .5); opacity: 0; transition: opacity .2s; }
.rpt-slideover.open .rpt-slideover-scrim { opacity: 1; }
.rpt-slideover-panel {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  width: 480px; max-width: 92vw; overflow-y: auto;
  background: var(--surface); box-shadow: 14px 0 40px rgba(0,0,0,.25);
  padding: 18px; transform: translateX(-100%); transition: transform .24s ease;
}
[dir="rtl"] .rpt-slideover-panel { transform: translateX(-100%); }
.rpt-slideover.open .rpt-slideover-panel { transform: translateX(0); }
.rpt-slideover-x {
  position: absolute; top: 14px; inset-inline-start: 14px;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--rpt-ink-mute); background: var(--rpt-zone); border: 1px solid var(--rpt-line);
  border-radius: 8px; cursor: pointer; z-index: 2;
}
.rpt-slideover-x svg { width: 18px; height: 18px; }
.rpt-slideover-body { padding-top: 8px; }
.rpt-slideover-body .rpt-idcard { margin-top: 0; }
.rpt-slideover-full { width: 100%; margin-top: var(--sp-4); }
@media (max-width: 640px) { .rpt-slideover-panel { width: 100vw; max-width: 100vw; padding: 14px; } }
.rpt-student-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline: 0;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-3);
}
.rpt-student-dropdown li {
  padding: 8px 12px;
  font-size: var(--fs-sm);
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
}
.rpt-student-dropdown li:hover,
.rpt-student-dropdown li.active { background: var(--brand-soft); color: var(--brand-strong); }
.rpt-student-dropdown li small { color: var(--muted); margin-inline-start: 6px; }
.rpt-student-dropdown .rpt-dd-empty { color: var(--muted); cursor: default; }

/* ─── كشف فصل (المرحلة 4) ─────────────────────────────────────────── */
/* منتقيان متصلان داخل الرأس الكحلي */
.rpt-connected-pickers { display: inline-flex; align-items: center; gap: 6px; }
.rpt-picker-arrow { color: var(--rpt-navy-sub); font-weight: 800; }
.rpt-navy-select {
  padding: 7px 12px; font-size: var(--fs-xs); font-weight: 700; font-family: inherit;
  color: #fff; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18); border-radius: 9px; cursor: pointer;
}
.rpt-navy-select option { color: var(--rpt-ink); }

/* الجدول المضغوط: فصل كامل في شاشة واحدة */
.rpt-table--dense th { padding: 7px 10px; font-size: 10px; }
.rpt-table--dense td { padding: 3px 10px; font-size: 11px; }
.rpt-table--dense .rpt-crow td { border-bottom: 1px solid var(--rpt-line-tight); }
.rpt-cname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-bar-xs { width: 40px; height: 4px; }
.rpt-zero { color: var(--rpt-ink-hint); }
.rpt-table--dense .rpt-bal { gap: 6px; }
.rpt-table--dense .rpt-bal-num { min-width: 14px; font-size: 11px; }

/* ─── النظرة العامة الغنية (المرحلة 5) ────────────────────────────── */
.rpt-summary-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-xs); color: var(--rpt-ink-mute);
  margin-bottom: var(--sp-3);
}
.rpt-summary-meta .rpt-linkbtn { margin-inline-start: auto; color: var(--rpt-blue-ink); }

/* توزيع الغياب داخل بطاقة الانضباط */
.rpt-hero-dist { margin-inline-start: auto; padding-inline-start: var(--sp-4); }
.rpt-hero-dist-label { font-size: var(--fs-xs); color: rgba(255,255,255,.8); margin-bottom: 8px; }
.rpt-dist-row { display: flex; flex-direction: column; gap: 6px; }
.rpt-dist-item { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: #fff; font-variant-numeric: tabular-nums; }
.rpt-dist-item strong { font-size: var(--fs-md); }
.rpt-dist-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.rpt-dist-dot--green { background: #7fdca9; }
.rpt-dist-dot--amber { background: #f0c674; }
.rpt-dist-dot--red   { background: #f3a48f; }

/* بطاقة يحتاجون انتباهك */
.rpt-attention { border-color: var(--rpt-amber); }
.rpt-attention-list { list-style: none; margin: 0; padding: 0; }
.rpt-attention-list li {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 2px; border-bottom: 1px solid var(--rpt-line-tight);
}
.rpt-attention-list li:last-child { border-bottom: none; }
.rpt-attention-sec { font-size: 11px; color: var(--rpt-ink-hint); }
.rpt-attention-val { margin-inline-start: auto; font-size: var(--fs-xs); font-weight: 700; color: var(--rpt-red-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* تقاريري المحفوظة */
.rpt-saved-list { list-style: none; margin: 0; padding: 0; }
.rpt-saved-list li { display: flex; align-items: center; gap: 9px; padding: 9px 2px; border-bottom: 1px solid var(--rpt-line-tight); }
.rpt-saved-list li:last-child { border-bottom: none; }
.rpt-saved-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.rpt-saved-time { font-size: 11px; color: var(--rpt-ink-hint); white-space: nowrap; }
.rpt-saved-del { background: none; border: none; color: var(--rpt-ink-hint); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px; }
.rpt-saved-del:hover { color: var(--rpt-red); background: var(--rpt-red-soft); }

/* ─── حالات التحميل / الخطأ / الفراغ ─────────────────────────────── */
.rpt-skeleton { display: flex; flex-direction: column; gap: var(--sp-3); }
.rpt-skel-bar {
  height: 64px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: rpt-shimmer 1.3s ease-in-out infinite;
}
.rpt-skel-bar.tall { height: 240px; }
@keyframes rpt-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.rpt-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-5);
  color: var(--muted);
}
.rpt-state svg { width: 48px; height: 48px; opacity: .5; }
.rpt-state strong { font-size: var(--fs-md); color: var(--ink); }
.rpt-state p { margin: 0; font-size: var(--fs-sm); max-width: 340px; line-height: 1.7; }
.rpt-state.is-error svg { color: var(--danger); opacity: .7; }

.report-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-4);
  padding: var(--sp-16) var(--sp-5);
  color: var(--muted);
}
.report-placeholder svg { width: 56px; height: 56px; opacity: .4; }
.report-placeholder p { margin: 0; font-size: var(--fs-base); }

/* ═══════════ الجوال ═══════════ */
@media (max-width: 640px) {
  .report-toolbar { flex-direction: column; align-items: stretch; }
  .report-toolbar-actions { margin-inline-start: 0; justify-content: space-between; flex-wrap: wrap; }
  .period-custom { margin-inline-start: 0; }
  .rpt-charts-2col { grid-template-columns: 1fr; }

  /* مساحة سفلية تُبعد المحتوى عن شريط التنقّل السفلي الثابت */
  .report-panels { padding-bottom: 84px; }

  /* الرأس الكحلي وأدواته يتكدّسان */
  .rpt-navy, .rpt-idcard { flex-direction: column; align-items: stretch; }
  .rpt-navy-tools, .rpt-idcard-tools { width: 100%; justify-content: flex-start; }
  .rpt-seg-group, .rpt-connected-pickers { flex-wrap: wrap; }
  .rpt-kpi-grid { grid-template-columns: repeat(2, 1fr); }

  /* البانر يتكدّس عموديًا على الجوال */
  .rpt-hero-banner { flex-wrap: wrap; gap: var(--sp-3); }
  .rpt-hero-breakdown, .rpt-hero-dist {
    margin-inline-start: 0;
    width: 100%;
    justify-content: space-around;
    padding-inline-start: 0;
    padding-top: var(--sp-3);
    border-top: 1px solid rgba(255,255,255,.25);
  }

  /* الجداول ذات التسميات تتحول لبطاقات؛ الجدول المضغوط (كشف فصل) يبقى بتمرير أفقي */
  .rpt-table:not(.rpt-table--dense) thead { display: none; }
  .rpt-table:not(.rpt-table--dense),
  .rpt-table:not(.rpt-table--dense) tbody,
  .rpt-table:not(.rpt-table--dense) tr,
  .rpt-table:not(.rpt-table--dense) td { display: block; width: 100%; }
  .rpt-table:not(.rpt-table--dense) tr.rpt-row {
    margin-bottom: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--rpt-line);
    border-inline-start-width: 3px;
    border-radius: var(--r-sm);
    background: var(--rpt-zone-2);
    min-height: 44px;
  }
  .rpt-table:not(.rpt-table--dense) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    padding: 7px 2px;
    border-bottom: 1px dashed var(--rpt-line-in);
    min-height: 30px;
  }
  .rpt-table:not(.rpt-table--dense) td:last-child { border-bottom: none; }
  .rpt-table:not(.rpt-table--dense) td[data-label]::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--rpt-ink-mute);
  }
  .rpt-group-row td { justify-content: center !important; }
  .rpt-group-row td::before { content: none !important; }

  /* الجدول المضغوط: تمرير أفقي داخل حاويته */
  .rpt-table--dense { min-width: 480px; }
}

/* ═══════════ الطباعة ═══════════ */
@media print {
  body * { visibility: hidden; }
  #reportPrintArea, #reportPrintArea * { visibility: visible; }
  #reportPrintArea {
    position: absolute;
    inset: 0;
    padding: 0;
    background: #fff;
    color: #000;
    font-variant-numeric: tabular-nums;
  }

  /* إخفاء كل العناصر التفاعلية (لا تُطبع) */
  .report-toolbar, .report-tabs, .panel-controls,
  .rpt-icon-btn, .rpt-phone-btn, .rpt-charts-2col, .rpt-kpi-ring,
  .rpt-collapse-row, .rpt-student-dropdown, .rpt-chips, .rpt-select,
  .rpt-seg-group, .rpt-connected-pickers, .rpt-facetabs, .rpt-showfull,
  .rpt-pager, .rpt-day-nav, .rpt-day-pick, .rpt-summary-meta,
  .rpt-slideover, .rpt-attention, .rpt-student-search-wrap,
  .rpt-events-foot, .rpt-vbars { display: none !important; }

  /* ترويسة رسمية */
  .rpt-print-header {
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid #000;
  }
  .rpt-print-header img { width: 56px; height: 56px; object-fit: contain; }
  .rpt-print-header h2 { margin: 0; font-size: 18px; }
  .rpt-print-header p { margin: 2px 0 0; font-size: 12px; color: #333; }
  .rpt-print-filters { font-weight: 700; color: #000 !important; }

  /* حالة الطالب: رموز أبيض/أسود بدل الألوان (● غائب ◐ متأخر ○ خروج ✓ حاضر) */
  .rpt-status { color: #000 !important; }
  .rpt-status .rpt-dot { display: none !important; }
  .rpt-status::before { margin-inline-end: 5px; font-size: 12px; }
  .rpt-status--absent::before  { content: "●"; }
  .rpt-status--late::before    { content: "◐"; }
  .rpt-status--leave::before   { content: "○"; }
  .rpt-status--present::before { content: "✓"; }
  .rpt-status--notrec::before  { content: "—"; }

  /* علامة عتبة الغياب → رمز أسود */
  .rpt-abs-mark { background: none !important; box-shadow: none !important; }
  .rpt-abs-mark::before { content: "●"; color: #000; }
  .rpt-abs-mark--green::before { content: "○"; }
  .rpt-abs-mark--amber::before { content: "◐"; }

  /* الجداول أبيض/أسود بحدود واضحة، بترتيب الشاشة */
  .rpt-table th, .rpt-table td { border: 1px solid #999 !important; color: #000 !important; }
  .rpt-table thead th { background: #eee !important; }
  .rpt-row { border-inline-start: none !important; }
  .rpt-bar { background: #ddd !important; }
  .rpt-bar-fill { background: #000 !important; }
  .rpt-card { border: none !important; box-shadow: none !important; padding: 0 !important; background: none !important; }
  .rpt-card-hint, .rpt-muted-sm, .rpt-sub-cell { color: #333 !important; }

  /* بطاقات المؤشرات → إطار أسود بلا لون */
  .rpt-kpicard { background: none !important; border: 1px solid #999 !important; }
  .rpt-kpicard-ic { background: none !important; border: 1px solid #666; color: #000 !important; }
  .rpt-kpicard-value, .rpt-kpicard-label, .rpt-kpicard-sub { color: #000 !important; }
  .rpt-kpi-grid { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; }

  /* بطاقة الانضباط بلا خلفية ملوّنة */
  .rpt-hero-banner { background: none !important; color: #000 !important; border: 1px solid #999 !important; box-shadow: none !important; }
  .rpt-hero-banner .rpt-kpi-label,
  .rpt-hero-banner .rpt-kpi-value,
  .rpt-hero-banner .rpt-kpi-sub,
  .rpt-hero-breakdown strong, .rpt-hero-breakdown span,
  .rpt-hero-dist, .rpt-hero-dist-label, .rpt-dist-item { color: #000 !important; }
  .rpt-hero-div { background: #999 !important; }
  .rpt-dist-dot { background: none !important; box-shadow: none !important; }
  .rpt-dist-dot--green::before { content: "○"; }
  .rpt-dist-dot--amber::before { content: "◐"; }
  .rpt-dist-dot--red::before   { content: "●"; }

  /* بطاقة هوية الطالب → أبيض/أسود */
  .rpt-idcard { background: none !important; color: #000 !important; border: 1px solid #999 !important; }
  .rpt-idcard-avatar { background: none !important; border: 1px solid #666; color: #000 !important; }
  .rpt-idcard-meta h2, .rpt-idcard-sub, .rpt-idcard-tel { color: #000 !important; }
  .rpt-navy { background: none !important; color: #000 !important; border-bottom: 2px solid #000; }
  .rpt-navy-title, .rpt-navy-trust { color: #000 !important; }

  /* التوقيعات + التذييل */
  .rpt-signatures {
    display: flex !important;
    justify-content: space-around;
    margin-top: 48px;
    padding-top: 12px;
  }
  .rpt-sign-line { text-align: center; font-size: 13px; }
  .rpt-sign-line span { display: block; margin-top: 40px; border-top: 1px solid #000; padding-top: 6px; min-width: 150px; }
  .rpt-print-footer {
    display: block !important;
    margin-top: 24px; padding-top: 8px;
    border-top: 1px solid #999;
    font-size: 10px; color: #555; text-align: center;
  }
}

/* عناصر تظهر في الطباعة فقط */
.rpt-print-header, .rpt-signatures, .rpt-print-footer { display: none; }

/* ─── نافذة تخصيص التوقيعات ──────────────────────────────────────── */
.rpt-sign-dialog {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0;
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  max-width: 420px;
  width: 92vw;
}
.rpt-sign-dialog::backdrop { background: rgba(16, 38, 63, .45); }
.rpt-sign-form { padding: var(--sp-5); }
.rpt-sign-form h3 { margin: 0 0 4px; font-size: var(--fs-lg); }
.rpt-sign-hint { margin: 0 0 var(--sp-4); font-size: var(--fs-xs); color: var(--muted); }
.rpt-sign-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rpt-sign-row input {
  flex: 1;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}
.rpt-sign-del {
  width: 30px; height: 30px;
  flex-shrink: 0;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.rpt-sign-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: var(--sp-4); }

.message-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.message-hero h2,
.message-hero p {
  margin: 0;
}

.message-hero h2 {
  margin-top: 8px;
  font-size: var(--fs-xl);
  line-height: 1.32;
  color: var(--ink);
}

.message-hero p {
  max-width: 720px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--muted);
}

.message-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.message-stat {
  min-height: 124px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: var(--sp-4);
  border: none;
  border-radius: var(--r-md);
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}

.message-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--brand);
}

.message-stat.warning::before {
  background: var(--gold);
}

.message-stat span,
.message-stat small {
  color: var(--muted);
  font-weight: 800;
}

.message-stat span {
  font-size: 13px;
}

.message-stat strong {
  color: var(--slate);
  font-size: 36px;
  line-height: 1;
}

.message-stat small {
  font-size: 11px;
}

.message-alert-panel {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--info-soft);
  border-color: var(--blue-200);
}

.message-alert-panel.is-warning {
  border-color: var(--amber-200);
  background: var(--warning-soft);
}

.message-alert-panel.is-danger {
  border-color: var(--red-200);
  background: var(--danger-soft);
}

.message-alert-panel strong {
  color: var(--brand-strong);
}

.message-alert-panel.is-warning strong {
  color: var(--warning);
}

.message-alert-panel.is-danger strong {
  color: var(--danger);
}

.message-alert-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.message-control-panel {
  margin-bottom: 14px;
  padding: 8px;
}

.message-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

/* ═══ النمط الأيقوني الموحد للتبويبات (إعدادات/رسائل/فصول) ═══ */
.icon-tabs .settings-tab,
.icon-tabs .message-tab,
.icon-tabs .data-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 78px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-card, #fff);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.icon-tabs .settings-tab svg,
.icon-tabs .message-tab svg,
.icon-tabs .data-tab svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.icon-tabs .settings-tab:hover:not(.active),
.icon-tabs .message-tab:hover:not(.active),
.icon-tabs .data-tab:hover:not(.active) {
  border-color: var(--brand);
  color: var(--brand-strong);
  transform: translateY(-1px);
}

.icon-tabs .settings-tab.active,
.icon-tabs .message-tab.active,
.icon-tabs .data-tab.active {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 81, 142, 0.28);
}

.message-tab-panel {
  display: none;
}

.message-tab-panel.active {
  display: block;
}

.send-summary-grid,
.send-confirm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.send-summary-grid div,
.send-confirm-grid div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e4eef6;
}

.send-summary-grid span,
.send-confirm-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.send-summary-grid strong,
.send-confirm-grid strong {
  color: var(--brand-strong);
  font-size: 27px;
  line-height: 1;
}

.message-policy-list {
  display: grid;
  gap: 10px;
}

.message-policy-list div {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf2f7;
  color: var(--ink);
  font-weight: 800;
}

.message-policy-list span {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: var(--gold);
}

/* ═══ بطاقات الإرسال لكل نوع حدث (غياب/تأخر/خروج مبكر) ═══ */
.send-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.send-event-card {
  display: flex;
  flex-direction: column;
}

.send-event-card .send-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.send-event-card [data-send-event] {
  margin-top: auto;
}

.send-detail {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8fb;
}

.send-detail summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  color: var(--brand-strong);
}

.send-detail-list {
  padding: 0 10px 10px;
}

.send-detail-list table {
  width: 100%;
  font-size: 13px;
}

.send-detail-empty {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.secondary-button.slim {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 12.5px;
}

/* ═══ فلاتر سجل الرسائل وترقيم الصفحات ═══ */
.log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.log-filters input[type="search"] {
  min-width: 190px;
}

.log-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}

.log-pager span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#composeAfterBalance.is-negative {
  color: var(--danger, #c0392b);
}

/* ═══ عداد أجزاء الرسالة تحت كل قالب ═══ */
.template-counter {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #1f7a4d;
}

.template-counter::before {
  content: "✓ ";
}

.template-counter.is-multi {
  color: #a95f00;
}

.template-counter.is-multi::before {
  content: "⚠ ";
}

.template-counter-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f4f8fb;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.7;
}

html[data-theme="dark"] .template-counter { color: #5cc08a; }
html[data-theme="dark"] .template-counter.is-multi { color: #dcb16a; }
html[data-theme="dark"] .template-counter-hint { background: var(--surface-2); border-color: var(--line); }

/* ═══ تقويم العام الدراسي والإجازات ═══ */
.cal-form { display: grid; gap: 14px; }

.cal-official-badge {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fdf6ea;
  border: 1px solid #f3e6cb;
  color: #a5720c;
  font-size: 12px;
  font-weight: 800;
}

.cal-field { display: grid; gap: 4px; align-content: start; }
.cal-field-label { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.cal-field input { min-height: 38px; padding: 7px 10px; font-size: 13.5px; }

/* الميلادي والهجري جنبًا إلى جنب، كلاهما مؤطّر */
.cal-datewrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.cal-datewrap > input[type="date"] { flex: 1 1 118px; min-width: 100px; }

.cal-hijri {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(20,81,142,.18);
  border-radius: var(--r-md);
  background: #fff;
  /* نفس تنسيق خط التاريخ الميلادي (حقول input) */
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.cal-hijri::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  /* الهلال يحتفظ بلون الهوية لتمييز التقويم الهجري */
  background-color: var(--brand-strong);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ═══ أقسام التقويم — كل قسم بلون خلفية مميّز ═══
   كل قسم: خلفية ملوّنة خفيفة + شريط لوني على الحافة + بطاقات بيضاء بداخله
   لإعطاء عمق بصري بدل الطبقة الواحدة الموحّدة. */
.cal-block {
  display: grid;
  gap: 12px;
  padding: 15px 17px;
  border: 1px solid var(--cal-line);
  border-inline-start: 4px solid var(--cal-accent);
  border-radius: 14px;
  background: var(--cal-bg);
}
.cal-block .cal-section-head h3 { color: var(--cal-accent); }
.cal-block .cal-section-head h3 svg { color: var(--cal-accent); }

/* ١ — العام الدراسي: أزرق (لون الهوية) */
.cal-year-bar {
  --cal-bg: #eaf2fb;
  --cal-line: #cfe0f2;
  --cal-accent: #14518e;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 1.6fr;
  gap: 18px;
  align-items: center;
  padding: 15px 17px;
  border: 1px solid var(--cal-line);
  border-inline-start: 4px solid var(--cal-accent);
  border-radius: 14px;
  background: var(--cal-bg);
}

/* ٢ — الفصلان: نيلي */
.cal-block--terms {
  --cal-bg: #f0eefc;
  --cal-line: #ddd7f5;
  --cal-accent: #5b4bc4;
}

/* ٣ — الإجازات: ذهبي */
.cal-block--holidays {
  --cal-bg: #fdf6ea;
  --cal-line: #f0e2c6;
  --cal-accent: #b07d1e;
}
.cal-year-id { display: flex; align-items: center; gap: 12px; }
.cal-year-badge {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--brand-strong); color: #fff;
}
.cal-year-badge svg { width: 23px; height: 23px; }
.cal-year-name-field { display: grid; gap: 3px; flex: 1; }
.cal-year-name-field input { min-height: 42px; font-size: 16px; font-weight: 800; }
/* قيمة محسوبة تلقائيًا لا حقل تحرير — خلفية مطفأة ومؤشر افتراضي */
.cal-year-name-field input[readonly] { background: rgba(120,120,120,.08); cursor: default; }
[data-theme="dark"] .cal-year-name-field input[readonly] { background: rgba(255,255,255,.04); }
.cal-year-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* بطاقتا الفصلين — كل فصل في سطر واحد (نفس هيئة صفوف الإجازات) */
.cal-terms { display: grid; grid-template-columns: 1fr; gap: 6px; }
.cal-term-card {
  display: grid;
  /* العمود الأخير فارغ بعرض زر الحذف في صفوف الإجازات
     حتى تتطابق أعمدة التاريخ بين القسمين تمامًا */
  grid-template-columns: minmax(120px, 1fr) auto auto 30px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #ddd7f5;
  border-radius: 9px;
  background: var(--surface-card, #fff);
}
.cal-term-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; color: var(--ink); }
.cal-term-num {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #e6f1fb; color: var(--brand-strong);
  font-size: 12px; font-weight: 800;
}
/* يذوب الغلاف حتى يصبح حقلا البداية والنهاية عمودين مباشرين في الصف */
.cal-term-fields { display: contents; }

/* قسم الإجازات */
.cal-section { display: grid; gap: 11px; }
.cal-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-section-head h3 { margin: 0; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.cal-section-head h3 svg { width: 18px; height: 18px; color: var(--gold, #c59650); }

/* صفوف الإجازات — مضغوطة، والهجري في نفس الصف بجانب الميلادي */
.cal-holidays { display: grid; gap: 6px; }
.cal-holiday-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #f0e2c6;
  border-radius: 9px;
  background: #fff;
}
/* ── الهيئة المضغوطة المشتركة: صفوف الإجازات + صفّا الفصلين ── */
/* التسمية (من/إلى، البداية/النهاية) بجانب الحقل لا فوقه — يوفّر سطرًا كاملاً */
.cal-holiday-row .cal-field,
.cal-term-card .cal-field {
  grid-auto-flow: column;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 6px;
}
/* عرض أدنى موحّد للتسمية حتى تتحاذى حقول التاريخ بين القسمين
   (البداية/النهاية أعرض من من/إلى) */
.cal-holiday-row .cal-field-label,
.cal-term-card .cal-field-label { font-size: 11px; min-width: 38px; }
/* لا التفاف: الميلادي والهجري يبقيان في سطر واحد */
.cal-holiday-row .cal-datewrap,
.cal-term-card .cal-datewrap { flex-wrap: nowrap; gap: 5px; }
.cal-holiday-row .cal-datewrap > input[type="date"],
.cal-term-card .cal-datewrap > input[type="date"] { flex: 0 0 auto; width: 122px; min-width: 0; }
/* عرض ثابت لصندوق الهجري — بدونه يختلف عرض العمود الأول من صف لآخر
   لأن نص الهجري يتفاوت طولًا (٥ رجب ١٤٤٨ هـ مقابل ١٢ ربيع الآخر ١٤٤٨ هـ) */
.cal-holiday-row .cal-hijri,
.cal-term-card .cal-hijri {
  flex: 0 0 auto;
  width: 142px;
  justify-content: center;
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;   /* نفس مقاس خط الحقل الميلادي في هذا الصف */
  border-radius: 7px;
  overflow: hidden;
}
.cal-holiday-row .cal-hijri::before,
.cal-term-card .cal-hijri::before { width: 11px; height: 11px; flex: 0 0 11px; }
/* تسمية مقروءة لقارئات الشاشة فقط — لا تشغل مساحة بصرية */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  min-width: 0;            /* يتجاوز min-width المفروض على .cal-field-label */
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* حقل اسم الإجازة: تسميته مخفيّة بصريًا (الصف ضيّق ولا يتحمّل تسمية ظاهرة
   دون قصّ أسماء الإجازات الفعلية)، لكنها تسمية <label> حقيقية مرتبطة
   بالحقل فتنطقها قارئات الشاشة — لا اعتماد على placeholder وحده */
.cal-holiday-row .cal-field--name { grid-template-columns: minmax(0, 1fr); }
.cal-holiday-row .cal-holiday-name { min-height: 30px; padding: 5px 9px; font-size: 12.5px; font-weight: 700; width: 100%; }
.cal-holiday-row input[type="date"],
.cal-term-card input[type="date"] { min-height: 30px; padding: 5px 7px; font-size: 12px; }
.cal-holiday-del {
  width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--danger, #c0392b);
  font-size: 13px; font-weight: 800; cursor: pointer;
}
.cal-holiday-del:hover { background: #fdecec; border-color: #f5d5d5; }
.cal-holiday-empty {
  margin: 0; padding: 11px; text-align: center;
  color: var(--muted); font-size: 12.5px; font-weight: 700;
  border: 1px dashed #e0cfa8; border-radius: 9px; background: rgba(255,255,255,.6);
}

/* ═══ تمييز حقول البداية/النهاية بلونين في كامل تبويب العام الدراسي ═══
   كل حقل بداية (من) أخضر فاتح — وكل حقل نهاية (إلى) أزرق فاتح. */
#settingsYearsPanel #calYearStart,
#settingsYearsPanel #calTerm1Start,
#settingsYearsPanel #calTerm2Start,
#settingsYearsPanel .cal-holiday-start {
  background: #e6f6ee;
  border-color: #b6ddc8;
}
#settingsYearsPanel #calYearEnd,
#settingsYearsPanel #calTerm1End,
#settingsYearsPanel #calTerm2End,
#settingsYearsPanel .cal-holiday-end {
  background: #e2edfc;
  border-color: #bcd5f3;
}

[data-theme="dark"] #settingsYearsPanel #calYearStart,
[data-theme="dark"] #settingsYearsPanel #calTerm1Start,
[data-theme="dark"] #settingsYearsPanel #calTerm2Start,
[data-theme="dark"] #settingsYearsPanel .cal-holiday-start {
  background: rgba(72,190,140,.13);
  border-color: rgba(72,190,140,.30);
}
[data-theme="dark"] #settingsYearsPanel #calYearEnd,
[data-theme="dark"] #settingsYearsPanel #calTerm1End,
[data-theme="dark"] #settingsYearsPanel #calTerm2End,
[data-theme="dark"] #settingsYearsPanel .cal-holiday-end {
  background: rgba(90,155,235,.15);
  border-color: rgba(90,155,235,.32);
}

/* قسما الفصلين والإجازات مضغوطان بنفس القياسات */
.cal-block--holidays,
.cal-block--terms { gap: 8px; padding: 11px 13px; }
.cal-block--holidays .cal-section-head h3,
.cal-block--terms .cal-section-head h3 { font-size: 14px; }

/* ═══ التجاوب ═══
   الأعمدة والعروض الثابتة أعلاه مخصّصة لسطح المكتب (محاذاة القسمين).
   دونها تُحرَّر كلها حتى لا يتجاوز أي عنصر عرض الشاشة. */
@media (max-width: 900px) {
  /* صفوف الفصول والإجازات تتكدّس رأسيًا */
  .cal-holiday-row,
  .cal-term-card {
    grid-template-columns: 1fr;
    align-items: stretch;
    row-gap: 6px;
  }
  .cal-holiday-row .cal-datewrap,
  .cal-term-card .cal-datewrap { flex-wrap: wrap; }
  /* تحرير العروض الثابتة (١٢٢px للميلادي و١٤٢px للهجري) */
  .cal-holiday-row .cal-datewrap > input[type="date"],
  .cal-term-card .cal-datewrap > input[type="date"] { flex: 1 1 140px; width: auto; min-width: 0; }
  .cal-holiday-row .cal-hijri,
  .cal-term-card .cal-hijri { flex: 1 1 130px; width: auto; min-width: 0; }
  .cal-holiday-del { justify-self: end; }

  /* شريط العام الدراسي: عمود واحد بدل عمودين */
  .cal-year-bar { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 620px) {
  /* كل حقل تاريخ على عرض كامل، والهجري ينتقل لسطره عند الحاجة */
  .cal-year-dates { grid-template-columns: 1fr; gap: 10px; }
  .cal-datewrap > input[type="date"],
  .cal-holiday-row .cal-datewrap > input[type="date"],
  .cal-term-card .cal-datewrap > input[type="date"] { flex: 1 1 100%; width: auto; min-width: 0; }
  .cal-hijri,
  .cal-holiday-row .cal-hijri,
  .cal-term-card .cal-hijri { flex: 1 1 100%; width: auto; min-width: 0; justify-content: flex-start; }
  /* التسمية فوق الحقل لا بجانبه — يجعل كل الحقول بعرض كامل متساوٍ
     (بجانبه كانت التسميات مختلفة العرض فتترك مساحات متفاوتة) */
  .cal-holiday-row .cal-field,
  .cal-term-card .cal-field {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 3px;
  }
  .cal-holiday-row .cal-field-label,
  .cal-term-card .cal-field-label { min-width: 0; }

  .cal-block,
  .cal-block--terms,
  .cal-block--holidays,
  .cal-year-bar { padding: 10px; }

  /* التذييل: العدّاد ثم الأزرار بعرض كامل */
  .cal-footer { flex-direction: column; align-items: stretch; gap: 10px; }
  .cal-workdays { min-width: 0; flex-wrap: wrap; padding: 11px 13px; }
  .cal-actions { flex-direction: column; align-items: stretch; }
  .cal-actions .primary-button,
  .cal-actions .secondary-button { width: 100%; }

  /* رأس القسم: العنوان وزر الإضافة سطرين عند الضيق */
  .cal-section-head { flex-wrap: wrap; }
}

/* ═══ شارة التعديلات غير المحفوظة ═══ */
.cal-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-track-note { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-track-note:empty { display: none; }
.cal-dirty-badge {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fdf6ea;
  border: 1px solid #e6cd9b;
  color: #8a6212;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
[data-theme="dark"] .cal-dirty-badge {
  background: rgba(220,177,106,.12); border-color: rgba(220,177,106,.34); color: #dcb16a;
}

/* زر الحفظ المعطّل عند غياب التغييرات */
#calSaveBtn:disabled { opacity: .5; cursor: not-allowed; }

/* ═══ نافذة التأكيد (تعيد استخدام هيئة نافذة النجاح) ═══ */
.cal-dialog { text-align: start; }
.cal-dialog .success-dialog__sub { text-align: start; line-height: 1.7; }
.cal-dialog__title { color: var(--ink); }
.cal-dialog--danger .cal-dialog__title { color: var(--danger, #c0392b); }
.cal-dialog--success .cal-dialog__title { color: var(--green-700, #157d69); }
/* اختيار المسار الرسمي داخل نافذة الاستعادة */
.cal-track-choice { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 14px 0 0; display: grid; gap: 8px; }
.cal-track-choice legend { padding: 0 4px; font-size: 12px; font-weight: 800; color: var(--muted); }
.cal-track-choice__option { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.cal-track-choice__option input { accent-color: var(--brand-strong); width: 16px; height: 16px; cursor: pointer; }
.cal-dialog__actions { display: flex; gap: 10px; margin-top: 20px; }
.cal-dialog__actions button { flex: 1; justify-content: center; }
.cal-dialog--danger .cal-dialog__confirm { background: var(--danger, #c0392b); border-color: var(--danger, #c0392b); }
.cal-dialog--danger .cal-dialog__confirm:hover { background: #a5311d; border-color: #a5311d; }

/* ═══ ملخّص أخطاء وتنبيهات التقويم ═══ */
.cal-issues { display: grid; gap: 8px; }
.cal-issue-group {
  padding: 10px 13px;
  border: 1px solid;
  border-inline-start-width: 4px;
  border-radius: 10px;
  font-size: 12.5px;
}
.cal-issue-group strong { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 800; }
.cal-issue-group ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 3px; }
.cal-issue-group li { line-height: 1.6; }
.cal-issue-group--error {
  background: #fdecec;
  border-color: #f0c4c4;
  border-inline-start-color: var(--danger, #c0392b);
  color: #8e2b21;
}
.cal-issue-group--warn {
  background: #fdf6ea;
  border-color: #f0e2c6;
  border-inline-start-color: #b07d1e;
  color: #7d5810;
}

/* حالة الحقل: خطأ (أحمر) أو تنبيه (ذهبي) — مع الرمز لا اللون وحده */
#settingsYearsPanel .is-invalid {
  border-color: var(--danger, #c0392b) !important;
  background: #fdecec !important;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, .12);
}
#settingsYearsPanel .is-warned {
  border-color: #d9a441 !important;
  box-shadow: 0 0 0 2px rgba(217, 164, 65, .14);
}
#settingsYearsPanel .is-invalid:focus,
#settingsYearsPanel .is-warned:focus { outline: 2px solid var(--brand-strong); outline-offset: 1px; }

[data-theme="dark"] .cal-issue-group--error {
  background: rgba(224, 92, 78, .10); border-color: rgba(224, 92, 78, .30);
  border-inline-start-color: #e05c4e; color: #f0a79f;
}
[data-theme="dark"] .cal-issue-group--warn {
  background: rgba(220, 177, 106, .10); border-color: rgba(220, 177, 106, .28);
  border-inline-start-color: #dcb16a; color: #dcb16a;
}
[data-theme="dark"] #settingsYearsPanel .is-invalid {
  background: rgba(224, 92, 78, .12) !important; border-color: #e05c4e !important;
}

/* تذييل: عدّاد أيام الدوام + الأزرار */
.cal-footer { display: flex; align-items: stretch; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cal-workdays {
  display: flex; align-items: center; gap: 13px;
  flex: 1; min-width: 280px;
  padding: 13px 17px;
  border-radius: 14px;
  background: #e8f5f2;
  border: 1px solid #cfe8e2;
  border-inline-start: 4px solid #157d69;
}
.cal-workdays-icon {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; background: #cfe8e1; color: #157d69;
}
.cal-workdays-icon svg { width: 23px; height: 23px; }
.cal-workdays-body { display: grid; gap: 1px; }
.cal-workdays-body strong { font-size: 27px; line-height: 1; font-weight: 800; color: #157d69; }
.cal-workdays-body > span { font-size: 12px; font-weight: 800; color: #157d69; }

/* تفصيل حساب أيام الدوام — مضغوط بجانب الرقم لا تحته */
.cal-workdays-breakdown {
  margin: 0 0 0 auto;
  display: grid;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.cal-wd-row { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.cal-workdays-breakdown dt { margin: 0; }
.cal-workdays-breakdown dd { margin: 0; font-variant-numeric: tabular-nums; }
.cal-wd-row--net { color: #157d69; font-weight: 800; padding-top: 2px; border-top: 1px solid #cfe8e2; }
[data-theme="dark"] .cal-wd-row--net { color: #5fc4ad; border-top-color: rgba(95,196,173,.28); }

.cal-actions { display: flex; gap: 10px; align-items: center; }

/* الوضع الليلي — تُحفظ الفروق اللونية بين الأقسام بصبغات شفافة */
[data-theme="dark"] .cal-year-bar {
  --cal-bg: rgba(60,130,215,.10);
  --cal-line: rgba(120,175,240,.22);
  --cal-accent: #6ba6e8;
}
[data-theme="dark"] .cal-block--terms {
  --cal-bg: rgba(130,115,235,.10);
  --cal-line: rgba(150,138,240,.22);
  --cal-accent: #9b8cf0;
}
[data-theme="dark"] .cal-block--holidays {
  --cal-bg: rgba(220,177,106,.09);
  --cal-line: rgba(220,177,106,.22);
  --cal-accent: #dcb16a;
}
[data-theme="dark"] .cal-term-card { background: var(--surface-2); border-color: rgba(150,138,240,.22); }
[data-theme="dark"] .cal-term-head { color: var(--ink); }
[data-theme="dark"] .cal-term-num { background: rgba(155,140,240,.18); color: #b3a6f5; }
[data-theme="dark"] .cal-hijri { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .cal-hijri::before { background-color: #9cc6f2; }
[data-theme="dark"] .cal-holiday-row { background: var(--surface-2); border-color: rgba(220,177,106,.20); }
[data-theme="dark"] .cal-holiday-del { background: rgba(255,255,255,.04); border-color: var(--line); color: #e87a7a; }
[data-theme="dark"] .cal-holiday-empty { background: rgba(255,255,255,.03); border-color: rgba(220,177,106,.25); }
[data-theme="dark"] .cal-workdays { background: rgba(95,196,173,.10); border-color: rgba(95,196,173,.20); border-inline-start-color: #5fc4ad; }
[data-theme="dark"] .cal-workdays-icon { background: rgba(95,196,173,.20); }
[data-theme="dark"] .cal-workdays-body strong,
[data-theme="dark"] .cal-workdays-body > span { color: #5fc4ad; }
[data-theme="dark"] .cal-official-badge { background: rgba(220,177,106,.10); border-color: rgba(220,177,106,.28); color: #dcb16a; }

/* ═══ إعدادات المدرسة الموسعة ═══ */
.compact-fieldset {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.compact-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
}

/* رقائق اختيار مضغوطة — بديل الصفوف الممتدة */
.form-grid .checkbox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.form-grid .checkbox-chips .section-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-height: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form-grid .checkbox-chips .section-check input {
  inline-size: 15px;
  block-size: 15px;
  min-height: 0;
  min-width: 0;
  accent-color: var(--brand-strong);
  margin: 0;
  flex: 0 0 auto;
}

.form-grid .checkbox-chips .section-check.is-selected {
  border-color: var(--brand-strong);
  background: #e8f0f8;
  color: var(--brand-strong);
  box-shadow: none;
}

html[data-theme="dark"] .form-grid .checkbox-chips .section-check {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .form-grid .checkbox-chips .section-check.is-selected {
  background: rgba(127, 178, 236, 0.16);
  border-color: #7fb2ec;
  color: #a9cdf4;
}

.settings-field-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f4f8fb;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.7;
}

html[data-theme="dark"] .settings-field-note { background: var(--surface-2); border-color: var(--line); }

.check-inline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.check-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-strong);
}

tr.row-inactive td {
  opacity: 0.55;
}

.template-helper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf2f7;
}

.template-helper strong {
  color: var(--ink);
  margin-left: 4px;
}

.template-helper span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f7fafc;
  border: 1px solid var(--line);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  direction: ltr;
}

.template-preview {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(197, 150, 80, 0.38);
  border-radius: 8px;
  background: linear-gradient(145deg, #f7fafc, #e8f0f6);
}

.template-preview span,
.template-preview strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.template-preview p {
  margin: 0;
  color: var(--ink);
  line-height: 1.8;
}

.sms-package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sms-package {
  min-height: 108px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid rgba(197, 150, 80, 0.55);
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fafc, #e2edf5);
  color: var(--brand-strong);
  box-shadow: var(--shadow-soft);
}

.sms-package strong {
  font-size: 28px;
  line-height: 1;
}

.sms-package span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.subscription-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.subscription-hero h2,
.subscription-hero p {
  margin: 0;
}

.subscription-hero h2 {
  margin-top: 8px;
  font-size: var(--fs-xl);
  line-height: 1.32;
  color: var(--ink);
}

.subscription-hero p {
  max-width: 780px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--muted);
}

/* ═══ بطاقات حالة الاشتراك: ملوّنة بأيقونات، وبطاقة الحالة تتلوّن ديناميكيًا ═══ */
.sub-stats {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--sp-4);
}

.sub-stat {
  min-height: 132px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 15px 17px;
  border: 1px solid transparent;
  border-radius: 14px;
}

.sub-stat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.sub-stat-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.sub-stat-icon svg { width: 20px; height: 20px; }

.sub-stat-label { font-size: 13px; font-weight: 800; }
.sub-stat strong { font-size: 29px; line-height: 1.15; font-weight: 800; }
.sub-stat small { font-size: 11.5px; font-weight: 700; line-height: 1.5; color: var(--muted); }

/* البطاقة الرئيسية — كحلي بارز */
.sub-stat--hero {
  background: linear-gradient(135deg, #14518e, #0e3760);
  border-color: #0e3760;
  color: #fff;
}
.sub-stat--hero .sub-stat-icon { background: rgba(255,255,255,.16); color: #fff; }
.sub-stat--hero .sub-stat-label { color: rgba(255,255,255,.82); }
.sub-stat--hero strong { color: #fff; font-size: 25px; }
.sub-stat--hero small { color: rgba(255,255,255,.72); }

.sub-stat--days { background: #e8f5f2; border-color: #cfe8e2; }
.sub-stat--days .sub-stat-icon { background: #cfe8e1; color: #157d69; }
.sub-stat--days .sub-stat-label,
.sub-stat--days strong { color: #157d69; }

.sub-stat--sms { background: #f0eefb; border-color: #e0dbf3; }
.sub-stat--sms .sub-stat-icon { background: #e2dcf6; color: #5b4bb3; }
.sub-stat--sms .sub-stat-label,
.sub-stat--sms strong { color: #5b4bb3; }

/* حالات ديناميكية لبطاقتي الحالة والأيام */
.sub-stat.is-active { background: #ecf6ee; border-color: #d5e9da; }
.sub-stat.is-active .sub-stat-icon { background: #d2ecd9; color: #2f7d4c; }
.sub-stat.is-active .sub-stat-label,
.sub-stat.is-active strong { color: #2f7d4c; }

.sub-stat.is-warning { background: #fdf6ea; border-color: #f3e6cb; }
.sub-stat.is-warning .sub-stat-icon { background: #f7e7c6; color: #a5720c; }
.sub-stat.is-warning .sub-stat-label,
.sub-stat.is-warning strong { color: #a5720c; }

.sub-stat.is-danger { background: #fdecec; border-color: #f5d5d5; }
.sub-stat.is-danger .sub-stat-icon { background: #f7d6d6; color: #b23b3b; }
.sub-stat.is-danger .sub-stat-label,
.sub-stat.is-danger strong { color: #b23b3b; }

[data-theme="dark"] .sub-stat--hero { background: linear-gradient(135deg, #1b3a5c, #12283f); border-color: #2b3a4c; }
[data-theme="dark"] .sub-stat--days { background: rgba(95,196,173,.10); border-color: rgba(95,196,173,.20); }
[data-theme="dark"] .sub-stat--days .sub-stat-icon { background: rgba(95,196,173,.20); color: #5fc4ad; }
[data-theme="dark"] .sub-stat--days .sub-stat-label,
[data-theme="dark"] .sub-stat--days strong { color: #5fc4ad; }
[data-theme="dark"] .sub-stat--sms { background: rgba(150,135,230,.12); border-color: rgba(150,135,230,.22); }
[data-theme="dark"] .sub-stat--sms .sub-stat-icon { background: rgba(150,135,230,.22); color: #b3a6ec; }
[data-theme="dark"] .sub-stat--sms .sub-stat-label,
[data-theme="dark"] .sub-stat--sms strong { color: #b3a6ec; }
[data-theme="dark"] .sub-stat.is-active { background: rgba(92,192,138,.10); border-color: rgba(92,192,138,.20); }
[data-theme="dark"] .sub-stat.is-active .sub-stat-icon { background: rgba(92,192,138,.20); color: #5cc08a; }
[data-theme="dark"] .sub-stat.is-active .sub-stat-label,
[data-theme="dark"] .sub-stat.is-active strong { color: #5cc08a; }
[data-theme="dark"] .sub-stat.is-warning { background: rgba(220,177,106,.10); border-color: rgba(220,177,106,.20); }
[data-theme="dark"] .sub-stat.is-warning .sub-stat-icon { background: rgba(220,177,106,.20); color: #dcb16a; }
[data-theme="dark"] .sub-stat.is-warning .sub-stat-label,
[data-theme="dark"] .sub-stat.is-warning strong { color: #dcb16a; }
[data-theme="dark"] .sub-stat.is-danger { background: rgba(226,75,74,.10); border-color: rgba(226,75,74,.22); }
[data-theme="dark"] .sub-stat.is-danger .sub-stat-icon { background: rgba(226,75,74,.20); color: #e87a7a; }
[data-theme="dark"] .sub-stat.is-danger .sub-stat-label,
[data-theme="dark"] .sub-stat.is-danger strong { color: #e87a7a; }

.subscription-alert {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 16px;
  background: linear-gradient(145deg, #f7fafc, #e2edf5);
}

.subscription-alert.is-warning {
  border-color: rgba(197, 150, 80, 0.62);
  background: linear-gradient(145deg, #fff5df, #edf4f8);
}

.subscription-alert.is-danger {
  border-color: rgba(184, 107, 75, 0.52);
  background: linear-gradient(145deg, #fbede4, #edf4f8);
}

.subscription-alert strong {
  color: var(--brand-strong);
}

.subscription-alert span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

[data-theme="dark"] .subscription-alert { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .subscription-alert.is-warning { background: rgba(220,177,106,.10); border-color: rgba(220,177,106,.28); }
[data-theme="dark"] .subscription-alert.is-danger { background: rgba(226,75,74,.10); border-color: rgba(226,75,74,.28); }
[data-theme="dark"] .subscription-alert strong { color: var(--ink); }

.subscription-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 16px;
  margin-bottom: 16px;
}

.subscription-detail-list,
.subscription-policy-list {
  display: grid;
  gap: 10px;
}

.subscription-detail-list div,
.subscription-policy-list div {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf2f7;
}

.subscription-detail-list span,
.subscription-policy-list div {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.subscription-detail-list strong {
  color: var(--slate);
  font-size: 15px;
}

.subscription-policy-list div {
  justify-content: flex-start;
  color: var(--ink);
  line-height: 1.7;
}

.subscription-policy-list span {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: var(--gold);
}

.subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* ═══ بطاقات الباقات: نمط تسعير احترافي بقوائم مميزات وباقة مميّزة ═══ */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-card, #fff);
  position: relative;
}

.plan-card-top { display: grid; gap: 4px; }

.plan-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 12px;
  background: rgba(20, 81, 142, 0.08);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.plan-card h3 {
  margin: 0;
  color: var(--slate);
  font-size: 23px;
  line-height: 1.3;
}

.plan-duration {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.plan-features {
  list-style: none;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  flex: 1;
}

.plan-features li {
  position: relative;
  padding-inline-start: 26px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--ink);
}

.plan-features li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e4f2ea url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f7d4c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") no-repeat center;
  background-size: 18px, 11px;
}

.plan-cta {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: transparent;
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
}

.plan-cta:hover:not(:disabled) { background: var(--brand); color: #fff; transform: translateY(-1px); }
.plan-cta.is-primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.plan-cta.is-primary:hover { background: var(--deep-blue, #0e3760); border-color: var(--deep-blue, #0e3760); color: #fff; }
.plan-cta.is-current { background: var(--surface-2); border-color: var(--line); color: var(--muted); cursor: default; }

/* الباقة المميّزة */
.plan-card.is-featured {
  border: 2px solid var(--brand);
  padding-top: 40px;
  box-shadow: 0 14px 34px rgba(20, 81, 142, .16);
}

.plan-ribbon {
  position: absolute;
  top: 0;
  inset-inline: -1px;
  background: var(--brand-strong);
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  padding: 6px;
  border-radius: 12px 12px 0 0;
}

[data-theme="dark"] .plan-card { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .plan-card h3 { color: var(--ink); }
[data-theme="dark"] .plan-badge { background: rgba(127,178,236,.14); color: #9cc6f2; }
[data-theme="dark"] .plan-features li { color: var(--ink); }
[data-theme="dark"] .plan-features li::before { background-color: rgba(92,192,138,.18); }
[data-theme="dark"] .plan-card.is-featured { border-color: #2f6db5; box-shadow: 0 14px 34px rgba(0,0,0,.4); }
[data-theme="dark"] .plan-ribbon { background: #2f6db5; }
[data-theme="dark"] .plan-cta { border-color: #2f6db5; color: #9cc6f2; }
[data-theme="dark"] .plan-cta.is-primary { background: #2f6db5; border-color: #2f6db5; color: #fff; }
[data-theme="dark"] .plan-cta.is-current { background: rgba(255,255,255,.05); border-color: var(--line); color: var(--muted); }

.subscription-invoices-panel {
  margin-top: 16px;
}

.excuse-portal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 12% 8%, rgba(197, 150, 80, 0.16) 0 120px, transparent 270px),
    linear-gradient(135deg, #dbe6ef 0%, #eef4f8 48%, #cfdce8 100%);
}

.excuse-card {
  width: min(720px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid rgba(197, 150, 80, 0.58);
  border-radius: 10px;
  padding: 22px;
  background: linear-gradient(145deg, #f7fafc, #e2edf5);
  box-shadow: var(--shadow);
}

.excuse-card .brand {
  background: linear-gradient(135deg, var(--brand), var(--slate));
  color: #ffffff;
}

.communication-hero {
  display: grid;
  align-items: center;
  margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.communication-hero h2,
.communication-hero p {
  margin: 0;
}

.communication-hero h2 {
  margin-top: 8px;
  font-size: var(--fs-xl);
  line-height: 1.32;
  color: var(--ink);
}

.communication-hero p {
  max-width: 760px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--muted);
}

.communication-builder {
  display: grid;
  gap: 14px;
}

.absence-selection-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf2f7;
}

/* ═══ مركز التواصل: بطاقة الطالب المختار ═══ */
.comm-student-card {
  margin: 4px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f8fb;
  display: grid;
  gap: 12px;
}

.comm-student-lead {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comm-student-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-strong);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.comm-student-lead strong { display: block; color: var(--ink); font-size: 15px; }
.comm-student-lead small { color: var(--muted); font-weight: 700; }

.comm-student-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.comm-student-facts > div {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 3px;
}

.comm-student-facts span { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.comm-student-facts strong { font-size: 15px; color: var(--brand-strong); }

/* شريط أدوات تحديد الأيام */
.comm-days-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.comm-selected-count {
  margin-inline-start: auto;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--brand-strong);
}

/* خلية الأيام داخل جدول السجل */
.comm-dates-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.comm-dates-cell span {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f8fb;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.excuse-days-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 9px;
}

.excuse-days-list > span,
.excuse-day-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #f7fafc;
  color: var(--ink);
  font-weight: 800;
}

.excuse-day-check input {
  width: 20px;
  height: 20px;
  min-height: auto;
  accent-color: var(--brand-strong);
}

/* ═══ بطاقات مؤشرات مركز التواصل: ألوان خفيفة وأرقام كبيرة منتظمة ═══ */
.comm-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.comm-metric {
  display: grid;
  gap: 5px;
  padding: 14px 16px 13px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.comm-metric-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 3px;
}

.comm-metric-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.comm-metric-icon svg { width: 19px; height: 19px; }

.comm-metric-label { font-size: 13px; font-weight: 800; }

.comm-metric strong {
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.comm-metric small { font-size: 11px; font-weight: 700; color: var(--muted); }

.comm-metric--blue  { background: #eef4fb; border-color: #dce8f5; }
.comm-metric--blue  .comm-metric-icon { background: #d6e6f7; color: #14518e; }
.comm-metric--blue  .comm-metric-label,
.comm-metric--blue  strong { color: #14518e; }

.comm-metric--amber { background: #fdf6ea; border-color: #f3e6cb; }
.comm-metric--amber .comm-metric-icon { background: #f7e7c6; color: #a5720c; }
.comm-metric--amber .comm-metric-label,
.comm-metric--amber strong { color: #a5720c; }

.comm-metric--green { background: #ecf6ee; border-color: #d5e9da; }
.comm-metric--green .comm-metric-icon { background: #d2ecd9; color: #2f7d4c; }
.comm-metric--green .comm-metric-label,
.comm-metric--green strong { color: #2f7d4c; }

.comm-metric--teal  { background: #e8f5f2; border-color: #cfe8e2; }
.comm-metric--teal  .comm-metric-icon { background: #cfe8e1; color: #157d69; }
.comm-metric--teal  .comm-metric-label,
.comm-metric--teal  strong { color: #157d69; }

[data-theme="dark"] .comm-metric--blue  { background: rgba(127,178,236,.10); border-color: rgba(127,178,236,.20); }
[data-theme="dark"] .comm-metric--blue  .comm-metric-icon { background: rgba(127,178,236,.20); color: #9cc6f2; }
[data-theme="dark"] .comm-metric--blue  .comm-metric-label,
[data-theme="dark"] .comm-metric--blue  strong { color: #9cc6f2; }

[data-theme="dark"] .comm-metric--amber { background: rgba(220,177,106,.10); border-color: rgba(220,177,106,.20); }
[data-theme="dark"] .comm-metric--amber .comm-metric-icon { background: rgba(220,177,106,.20); color: #dcb16a; }
[data-theme="dark"] .comm-metric--amber .comm-metric-label,
[data-theme="dark"] .comm-metric--amber strong { color: #dcb16a; }

[data-theme="dark"] .comm-metric--green { background: rgba(92,192,138,.10); border-color: rgba(92,192,138,.20); }
[data-theme="dark"] .comm-metric--green .comm-metric-icon { background: rgba(92,192,138,.20); color: #5cc08a; }
[data-theme="dark"] .comm-metric--green .comm-metric-label,
[data-theme="dark"] .comm-metric--green strong { color: #5cc08a; }

[data-theme="dark"] .comm-metric--teal  { background: rgba(95,196,173,.10); border-color: rgba(95,196,173,.20); }
[data-theme="dark"] .comm-metric--teal  .comm-metric-icon { background: rgba(95,196,173,.20); color: #5fc4ad; }
[data-theme="dark"] .comm-metric--teal  .comm-metric-label,
[data-theme="dark"] .comm-metric--teal  strong { color: #5fc4ad; }

#communicationView .content-grid { gap: 12px; }
#communicationView .panel { padding: 14px; }
#communicationView .panel-header { margin-bottom: 10px; }
#communicationView .panel-header h2 { font-size: 15.5px; }
#communicationView .panel-header p { font-size: 12.5px; margin-top: 2px; }
#communicationView .form-grid { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#communicationView .form-grid label { font-size: 12.5px; gap: 4px; }
#communicationView input:not([type="checkbox"]):not([type="file"]),
#communicationView select { min-height: 38px; padding: 7px 10px; font-size: 13.5px; }

#communicationView .comm-student-card { margin: 2px 0 10px; padding: 10px; gap: 8px; }
#communicationView .comm-student-avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: 15px; }
#communicationView .comm-student-lead strong { font-size: 14px; }
#communicationView .comm-student-facts { gap: 6px; }
#communicationView .comm-student-facts > div { padding: 6px 9px; gap: 1px; }
#communicationView .comm-student-facts span { font-size: 10.5px; }
#communicationView .comm-student-facts strong { font-size: 13.5px; }

#communicationView .comm-days-toolbar { margin-bottom: 8px; gap: 6px; }
#communicationView .excuse-days-list { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 6px; }
#communicationView .excuse-day-check { min-height: 34px; padding: 5px 9px; gap: 7px; font-size: 12.5px; font-weight: 700; }
#communicationView .excuse-day-check input { width: 16px; height: 16px; }
#communicationView .excuse-day-check .status-pill { font-size: 9.5px; padding: 2px 7px; min-height: 0; }
#communicationView .absence-selection-panel .panel-header { margin-bottom: 6px; }

#communicationView .message-policy-list { gap: 6px; }
#communicationView .message-policy-list div { min-height: 34px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; gap: 8px; }
#communicationView .message-policy-list span { width: 8px; height: 8px; flex-basis: 8px; }

#communicationView .communication-log-panel th { padding: 8px 9px; font-size: 11.5px; }
#communicationView .communication-log-panel td { padding: 8px 9px; font-size: 13px; line-height: 1.55; }
#communicationView .comm-dates-cell { gap: 3px; }
#communicationView .comm-dates-cell span { padding: 1px 7px; font-size: 10.5px; }
#communicationView .row-actions { gap: 4px; }
#communicationView .mini-button { min-height: 28px; padding: 3px 9px; font-size: 11.5px; }
#communicationView .log-pager { margin-top: 10px; }
#communicationView #createExcuseLink { min-height: 42px; }

.excuse-day-check { cursor: pointer; transition: border-color .15s, background .15s; }
.excuse-day-check:hover:not(.is-blocked) { border-color: var(--brand); }
.excuse-day-check.is-selected { border-color: var(--brand-strong); background: #e6f1fb; }
.excuse-day-check.is-blocked { opacity: .62; cursor: not-allowed; }
.excuse-day-check .status-pill { margin-inline-start: auto; font-size: 10.5px; }

.communication-log-panel {
  margin-top: 16px;
}

.recorder-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.quick-action {
  min-height: 170px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(145deg, #f7fafc, #efe6d6);
  color: var(--ink);
  text-align: right;
  box-shadow: var(--shadow-soft);
}

.quick-action span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: linear-gradient(145deg, #f7fafc, #dfeaf2);
  border: 1px solid rgba(197, 150, 80, 0.72);
  font-size: 28px;
  box-shadow: var(--shadow-soft);
}

.quick-action strong,
.quick-action small {
  display: block;
}

.quick-action strong {
  font-size: 20px;
}

.quick-action small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.assigned-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assigned-sections span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border-radius: 999px;
  padding: 6px 12px;
  background: linear-gradient(145deg, #f8fbfe, var(--brand-soft));
  color: var(--brand-strong);
  border: 1px solid #d8e2eb;
  font-size: 13px;
  font-weight: 800;
}

.login-hint {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--line);
}

.login-hint .ghost-button {
  min-height: 38px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
}

.login-hint .ghost-button:hover {
  color: var(--brand);
}

.roles-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.role-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  background: var(--surface-card);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}

.role-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue-600);
}

.role-card.owner::before {
  background: var(--green-600);
}

.role-card.recorder::before {
  background: var(--amber-500);
}

.role-card > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 800;
}

.role-card h2 {
  margin: 12px 0 6px;
  font-size: 19px;
}

.role-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.compact-form {
  grid-template-columns: 1fr;
}

.assigned-sections-field {
  display: grid;
  gap: 12px;
  margin: 4px 0 0;
  padding: 18px 16px 16px;
  border: 1px solid rgba(187, 200, 216, 0.72);
  border-radius: 8px;
  background: #fbfdff;
}

.field-heading {
  display: grid;
  gap: 6px;
}

/* ─── مصفوفة الصلاحيات (نظام الصلاحيات المرن) ─────────────────────────── */
.permissions-field {
  display: grid;
  gap: 12px;
  margin: 4px 0 0;
  padding: 18px 16px 16px;
  border: 1px solid rgba(187, 200, 216, 0.72);
  border-radius: 8px;
  background: #fbfdff;
}

.permissions-field legend {
  padding: 0 8px;
  font-weight: 900;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.permission-grid {
  display: grid;
  gap: 14px;
}

.perm-group {
  display: grid;
  gap: 8px;
}

.perm-group-label {
  font-size: 12px;
  font-weight: 900;
  color: var(--brand-strong);
  letter-spacing: 0.2px;
}

.perm-group .section-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid rgba(197, 150, 80, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.perm-group .section-check:hover {
  border-color: var(--accent);
  background: #f8fbfe;
}

.perm-group .section-check input {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--brand-strong);
}

.perm-group .section-check.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.perm-group .section-check small {
  font-weight: 700;
  color: var(--muted);
}

html[data-theme="dark"] .permissions-field {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .perm-group .section-check {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--ink);
}

.assigned-sections-field legend {
  padding: 0 8px;
  font-weight: 900;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.field-heading small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.selected-sections-count {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 10px;
  background: #e7eef6;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.form-grid .section-checkbox-grid {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  padding: 2px 2px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 81, 142, 0.35) transparent;
}

.form-grid .section-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid rgba(197, 150, 80, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.form-grid .section-check:hover {
  border-color: var(--accent);
  background: #f8fbfe;
}

.form-grid .section-check.is-selected {
  border-color: var(--brand-strong);
  background: #e8f0f8;
  color: var(--brand-strong);
  box-shadow: inset 4px 0 0 var(--brand-strong);
}

.form-grid .section-check input {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--brand-strong);
  flex: 0 0 auto;
  margin: 0;
}

.form-grid .section-check span {
  display: block;
  min-width: 0;
  color: inherit;
  line-height: 1.5;
  white-space: normal;
}

.data-management-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.data-management-hero span {
  color: var(--blue-600);
  font-weight: 800;
  font-size: var(--fs-xs);
}

.data-management-hero p {
  color: var(--muted);
}

.data-management-hero h2,
.data-management-hero p {
  margin: 0;
}

.data-management-hero h2 {
  margin-top: 4px;
  font-size: var(--fs-xl);
  line-height: 1.32;
  color: var(--ink);
}

.data-management-hero p {
  max-width: 760px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}

.data-management-hero .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.data-management-hero .primary-button {
  white-space: nowrap;
}

.student-admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.student-admin-stats article {
  padding: var(--sp-4);
  display: grid;
  gap: var(--sp-1);
  border: none;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.student-admin-stats span {
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.student-admin-stats strong {
  color: var(--ink);
  font-size: var(--fs-2xl);
  line-height: 1.1;
}

.data-control-panel {
  margin-bottom: 16px;
  padding: 8px;
}

.data-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.data-tab-panel {
  display: none;
}

.data-tab-panel.active {
  display: block;
}

.settings-hero {
  display: grid;
  align-items: center;
  margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.settings-hero .dashboard-kicker {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-200);
}

.settings-hero h2,
.settings-hero p {
  margin: 0;
}

.settings-hero h2 {
  margin-top: 4px;
  font-size: var(--fs-xl);
  line-height: 1.32;
  color: var(--ink);
}

.settings-hero p {
  max-width: 800px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--muted);
}

.settings-control-panel {
  margin-bottom: 16px;
  padding: 8px;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.active {
  display: block;
}

/* بطاقة بيانات المدرسة جزء رئيسي من صفحة الإعدادات، لذلك تمتد مع
   مساحة المحتوى بدل أن تلتصق باليمين وتترك فراغاً غير متوازن يساراً. */
#settingsSchoolPanel .form-panel {
  width: 100%;
  max-width: none;
}

.section-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.school-section-card {
  min-height: 220px;
  display: grid;
  align-content: space-between;
  gap: 13px;
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}

.school-section-card:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--blue-200);
}

.school-section-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue-600);
}

.school-section-card.is-archived {
  opacity: 0.78;
}

.school-section-card.is-archived::before {
  background: var(--mist-blue);
}

.school-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.school-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.school-section-head h3 {
  margin: 3px 0 0;
  color: var(--slate);
  font-size: 21px;
  line-height: 1.35;
}

.school-section-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.school-section-meta div {
  min-height: 68px;
  padding: 10px;
  border: 1px solid rgba(187, 200, 216, 0.7);
  border-radius: 8px;
  background: rgba(248, 251, 253, 0.82);
}

.school-section-meta span,
.student-record-mini {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.school-section-meta strong {
  display: block;
  margin-top: 5px;
  color: var(--slate);
  font-size: 18px;
  line-height: 1.25;
}

.school-section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.section-management-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.student-record-mini {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.6;
}

.mini-button.danger {
  border-color: rgba(184, 107, 75, 0.42);
  color: var(--danger);
  background: var(--danger-soft);
}

.status-pill.muted {
  background: var(--ice);
  color: var(--muted);
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-3);
}

dialog::backdrop {
  background: rgba(10, 40, 69, 0.45);
}

.dialog-form {
  display: grid;
  gap: var(--sp-4);
}

.dialog-form h2 {
  margin: 0 0 4px;
  font-size: var(--fs-xl);
  line-height: var(--lh-tight);
  color: var(--blue-800);
}

.dialog-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: var(--sp-2);
}

.dialog-actions .primary-button {
  order: -1;
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: 400px;
  z-index: 400;
  background: var(--slate);
  color: #ffffff;
  border-radius: var(--r-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
  transition: var(--t-base) var(--ease);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── خط فاصل (لوحة اليوم) ─────────────────────────────────── */
.db-sep {
  height: 2px;
  margin: -9px 0 9px;
  background: linear-gradient(90deg, transparent 0%, rgba(20,81,142,0.3) 20%, #14518e 50%, rgba(20,81,142,0.3) 80%, transparent 100%);
  flex-shrink: 0;
}
[data-theme="dark"] .db-sep {
  background: linear-gradient(90deg, transparent 0%, rgba(20,81,142,0.2) 20%, rgba(20,81,142,0.5) 50%, rgba(20,81,142,0.2) 80%, transparent 100%);
}

/* ── نافذة نجاح الحفظ ───────────────────────────────────── */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 40, 69, 0.5);
  backdrop-filter: blur(2px);
  padding: 16px;
  animation: overlayFadeIn .2s ease both;
}


@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.success-dialog {
  width: min(380px, 100%);
  text-align: center;
  padding: var(--sp-6) var(--sp-6) 28px;
  border-radius: 20px;
  border: 0;
  background: var(--bg, #fff);
  box-shadow: var(--shadow-3);
  animation: dialogSlideUp .3s var(--ease) both;
}

@keyframes dialogSlideUp {
  from { transform: translateY(24px) scale(.96); opacity: 0; }
  to   { transform: translateY(0)     scale(1);   opacity: 1; }
}

.success-dialog__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.success-dialog__icon svg {
  width: 100%;
  height: 100%;
  animation: successPop .35s var(--ease) .1s both;
}

@keyframes successPop {
  0%   { transform: scale(.6); opacity: 0; }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}

.success-dialog__title {
  margin: 0 0 8px;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--green-700);
  line-height: var(--lh-tight);
}

.success-dialog__sub {
  margin: 0 0 28px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.6;
  min-height: 1em;
}

.success-dialog__btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--green-600);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 600;
  font-family: inherit;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.success-dialog__btn:hover  { background: var(--green-700); }
.success-dialog__btn:active { background: var(--green-800); }

html[data-theme="dark"] .success-dialog        { background: var(--surface); }
html[data-theme="dark"] .success-dialog__title { color: var(--green-300); }

@media (max-width: 980px) {
  .public-header {
    flex-wrap: wrap;
    padding-top: 14px;
  }

  .public-header-actions {
    margin-right: auto;
  }

  .public-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .public-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 28px 0;
  }

  .feature-grid,
  .pricing-grid,
  .faq-grid {
    grid-template-columns: 1fr 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(306px, 88vw);
    transform: translateX(105%);
    transition: 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 9;
    display: block;
    background: rgba(9, 27, 25, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
  }

  .mobile-scrim.show {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-button {
    display: inline-grid;
    place-items: center;
  }

  .metrics-grid,
  .dashboard-hero,
  .content-grid,
  .report-grid,
  .roles-summary,
  .recorder-actions {
    grid-template-columns: 1fr 1fr;
  }

  .hero-band {
    align-items: flex-start;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
    line-height: 1.6;
    background:
      radial-gradient(circle at 0% 0%, rgba(197, 150, 80, 0.3) 0 86px, transparent 210px),
      linear-gradient(135deg, #dbe6ef 0%, #eef4f8 50%, #ccdce8 100%),
      var(--bg);
  }

  .public-main {
    width: min(100% - 22px, 1180px);
    padding: 8px 0 34px;
  }

  .public-header {
    width: min(100% - 22px, 1180px);
    min-height: auto;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
  }

  .public-brand {
    gap: 8px;
    padding: 0;
  }

  .public-brand .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .public-brand strong {
    font-size: 18px;
  }

  .public-brand span {
    font-size: 11px;
  }

  .public-nav {
    order: 4;
    width: auto;
    flex: 1 1 100%;
    gap: 14px;
    justify-content: center;
    overflow-x: auto;
    padding: 0;
  }

  .public-header-actions {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-right: 0;
  }

  .public-header-actions .ghost-button,
  .public-header-actions .secondary-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .public-hero {
    gap: 14px;
    padding: 10px 0 22px;
  }

  .public-hero-copy,
  .public-preview,
  .setup-card {
    padding: 14px;
  }

  .public-kicker,
  .section-heading span,
  .plan-badge {
    min-height: 26px;
    padding: 3px 10px;
    font-size: 11px;
  }

  .public-hero h1 {
    margin: 12px 0 10px;
    font-size: 24px;
    line-height: 1.42;
  }

  .public-hero p {
    font-size: 14px;
    line-height: 1.75;
  }

  .public-actions,
  .trust-row {
    align-items: stretch;
    flex-direction: column;
  }

  .public-actions {
    gap: 10px;
    margin-top: 14px;
  }

  .trust-row {
    gap: 7px;
    margin-top: 12px;
  }

  .trust-row span {
    padding: 6px 10px;
    font-size: 11px;
  }

  .public-preview {
    box-shadow: var(--shadow-soft);
  }

  .preview-top {
    min-height: 72px;
    padding: 14px;
  }

  .preview-top strong {
    font-size: 34px;
  }

  .preview-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin: 10px 0;
  }

  .preview-cards div {
    min-height: 68px;
    padding: 10px;
  }

  .preview-cards span {
    font-size: 11px;
  }

  .preview-cards strong {
    font-size: 24px;
  }

  .preview-list {
    gap: 7px;
  }

  .preview-list p {
    padding: 10px 11px;
    font-size: 12px;
  }

  .public-section {
    padding: 26px 0;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .section-heading h1,
  .section-heading h2 {
    font-size: 23px;
    line-height: 1.42;
  }

  .preview-cards,
  .feature-grid,
  .pricing-grid,
  .faq-grid,
  .setup-form,
  .setup-checklist,
  .setup-option-grid,
  .stage-options,
  .grade-row {
    grid-template-columns: 1fr;
  }

  .setup-section {
    padding: 13px;
  }

  .setup-section-title h2 {
    font-size: 16px;
  }

  .naming-mode {
    align-items: stretch;
    flex-direction: column;
  }

  .grade-counter {
    justify-content: space-between;
  }

  .price-card.featured {
    transform: none;
  }

  .feature-card,
  .price-card,
  .faq-grid article {
    padding: 14px;
  }

  .feature-card > span {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .feature-card h3,
  .price-card h3,
  .faq-grid h3 {
    font-size: 16px;
  }

  .main {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .metrics-grid,
  .content-grid,
  .report-grid,
  .roles-summary,
  .recorder-actions,
  .section-status-grid,
  .pending-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .daily-progress {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard-hero-copy {
    min-height: auto;
    padding: 20px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  #dashboardView .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .recording-summary {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .recording-summary-copy,
  .recording-card {
    min-height: 86px;
  }

  #dashboardView .metric {
    min-height: 126px;
    padding: 13px;
  }

  #dashboardView .metric-icon {
    margin-bottom: 0;
  }

  #dashboardView .metric::after {
    display: none;
  }

  #dashboardView .metric span {
    font-size: 12px;
  }

  .dashboard-hero h2 {
    font-size: 24px;
  }

  .dashboard-score-card {
    min-height: auto;
    grid-template-columns: auto 1fr;
    justify-items: start;
  }

  .score-ring {
    width: 86px;
    height: 86px;
  }

  .score-ring span {
    font-size: 23px;
  }

  .dashboard-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-tab {
    padding: 8px 9px;
    font-size: 12px;
  }

  .section-card-header,
  .absence-group-header,
  .pending-card {
    align-items: stretch;
    flex-direction: column;
  }

  .section-card-stats {
    gap: 7px;
  }

  .section-card-stats div {
    min-height: 56px;
    padding: 8px;
  }

  .section-card-actions,
  .student-chip-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .student-chip {
    justify-content: space-between;
    border-radius: 8px;
  }

  .login-hint {
    grid-template-columns: 1fr;
  }

  .hero-band {
    flex-direction: column;
    min-height: auto;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px;
  }

  #recorderHomeView .hero-band {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
  }

  #recorderHomeView .hero-stamp {
    grid-column: 1 / -1;
  }

  .hero-band h2 {
    font-size: 19px;
  }

  #recorderHomeView .hero-band h2 {
    font-size: 17px;
  }

  #recorderHomeView .hero-band p {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .hero-illustration {
    width: 72px;
    height: 82px;
  }

  #recorderHomeView .hero-illustration {
    width: 58px;
    height: 64px;
  }

  .manager-avatar {
    transform: scale(0.72);
  }

  #recorderHomeView .manager-avatar {
    transform: scale(0.56);
  }

  .hero-stamp {
    width: 100%;
    min-width: 0;
    padding: 13px;
  }

  .hero-stamp strong {
    font-size: 28px;
  }

  .stamp-icon {
    width: 38px;
    height: 38px;
    top: -16px;
    font-size: 24px;
  }

  .hero-stamp .stamp-icon {
    font-size: 24px;
    line-height: 38px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 88px;
    padding: 14px 14px 14px 74px;
  }

  .metric-icon {
    width: 40px;
    height: 40px;
    top: 13px;
    left: 14px;
    font-size: 21px;
  }

  .metric span {
    margin-bottom: 9px;
    font-size: 12px;
  }

  .metric strong {
    font-size: 30px;
  }

  .panel {
    padding: 14px;
  }

  .panel h2 {
    font-size: 17px;
  }

  .panel p {
    font-size: 12px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .quick-action {
    min-height: 104px;
    padding: 14px;
  }

  .quick-action span {
    width: 44px;
    height: 44px;
    font-size: 23px;
  }

  .quick-action strong {
    font-size: 17px;
  }

  .quick-action small {
    font-size: 12px;
  }

  .role-card {
    min-height: 118px;
    padding: 14px;
  }

  .role-card h2 {
    font-size: 17px;
  }

  .student-check-grid {
    grid-template-columns: 1fr;
  }

  .student-check {
    min-height: 38px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    min-height: 40px;
    padding: 8px 12px;
    white-space: normal;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    display: grid;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
  }

  td {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    padding: 0;
    border-bottom: 0;
    font-size: 14px;
    line-height: 1.65;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
  }

  .row-badge {
    width: 30px;
    height: 30px;
    margin-left: 7px;
    font-size: 12px;
  }

  dialog {
    width: calc(100vw - 22px);
  }

  .dialog-form {
    gap: 11px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    text-align: center;
    transform: translateY(10px);
    white-space: normal;
  }
  .toast.show {
    transform: translateY(0);
  }
}

/* Mobile-first refinement layer */
@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
  }

  .sidebar {
    width: min(336px, calc(100vw - 26px));
    padding: 16px 12px;
    border-radius: 0 0 0 14px;
    box-shadow: -22px 0 48px rgba(16, 38, 63, 0.26);
  }

  .brand {
    min-height: 74px;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 14px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    font-size: 24px;
  }

  .nav-item {
    min-height: 50px;
    padding: 8px;
  }

  .nav-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  #dashboardView .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recording-summary {
    grid-template-columns: 1fr 1fr;
  }

  .recording-summary-copy {
    grid-column: 1 / -1;
  }

  .dashboard-tabs {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
}

@media (max-width: 760px) {
  :root {
    --shadow: 0 14px 30px rgba(16, 38, 63, 0.12);
    --shadow-soft: 0 8px 18px rgba(16, 38, 63, 0.08);
  }

  body {
    font-size: 14px;
    line-height: 1.65;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    padding: 10px 12px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .table-action,
  .mini-button {
    min-height: 46px;
    justify-content: center;
  }

  .public-main,
  .public-header {
    width: min(100% - 24px, 1180px);
  }

  .public-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .public-brand {
    justify-content: center;
  }

  .public-nav {
    width: 100%;
    justify-content: flex-start;
    padding: 4px 2px 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .public-nav::-webkit-scrollbar {
    display: none;
  }

  .public-header-actions,
  .public-actions,
  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .public-hero-copy {
    border-radius: 10px;
  }

  .public-hero h1 {
    font-size: 25px;
  }

  .preview-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .preview-cards div {
    min-width: 0;
  }

  .preview-cards span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .setup-screen {
    display: block;
    padding: 12px;
  }

  .setup-card {
    width: 100%;
    padding: 16px;
    border-radius: 10px;
  }

  .setup-form,
  .setup-option-grid,
  .stage-options,
  .setup-checklist,
  .grade-row {
    grid-template-columns: 1fr;
  }

  .setup-section-title {
    align-items: center;
  }

  .setup-choice,
  .grade-row,
  .setup-checklist div {
    min-height: 52px;
  }

  .grade-counter {
    justify-content: space-between;
  }

  .main {
    padding: 12px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px 12px;
    margin: -12px -12px 14px;
    padding: 14px 14px 13px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }

  .topbar-heading {
    min-width: 0;
  }

  .eyebrow {
    margin-bottom: 7px;
  }

  .topbar h1 {
    font-size: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .date-card {
    width: 100%;
  }

  .menu-button,
  .icon-button {
    width: 46px;
    height: 46px;
    min-height: 46px;
  }

  .dashboard-hero,
  .content-grid,
  .report-grid,
  .roles-summary,
  .recorder-actions,
  .message-metrics,
  .send-summary-grid,
  .send-confirm-grid,
  .form-grid,
  .toolbar,
  .section-status-grid,
  .pending-grid,
  .recording-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    gap: 10px;
    margin-bottom: 12px;
  }

  .dashboard-hero-copy {
    min-height: 0;
    padding: 18px;
    border-radius: 10px;
  }

  .dashboard-hero h2 {
    margin-top: 12px;
    font-size: 23px;
  }

  .dashboard-hero p {
    font-size: 13px;
  }

  .dashboard-score-card {
    min-height: 96px;
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: start;
    padding: 14px;
  }

  .score-ring {
    width: 82px;
    height: 82px;
  }

  #dashboardView .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 10px;
  }

  #dashboardView .metric {
    min-height: 112px;
    grid-template-columns: 38px minmax(0, 1fr);
    column-gap: 9px;
    padding: 12px;
    border-radius: 10px;
  }

  #dashboardView .metric-icon {
    width: 38px;
    height: 38px;
  }

  #dashboardView .metric-icon svg {
    width: 20px;
    height: 20px;
  }

  #dashboardView .metric span {
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
  }

  #dashboardView .metric strong {
    font-size: 31px;
  }

  .recording-summary-copy,
  .recording-card {
    min-height: 82px;
    border-radius: 10px;
  }

  .recording-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .recording-card .metric-icon {
    width: 40px;
    height: 40px;
  }

  .recording-card strong {
    font-size: 30px;
  }

  .dashboard-control-panel {
    padding: 12px;
  }

  #dashboardView .panel-header select {
    width: 100%;
    min-width: 0;
  }

  .dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }

  .message-hero {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
    border-radius: 10px;
  }

  .subscription-hero {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
    border-radius: 10px;
  }

  .settings-hero {
    min-height: 0;
    padding: 18px;
    border-radius: 10px;
  }

  .communication-hero {
    min-height: 0;
    padding: 18px;
    border-radius: 10px;
  }

  .message-hero h2,
  .subscription-hero h2,
  .settings-hero h2,
  .communication-hero h2 {
    font-size: 23px;
  }

  .message-hero p,
  .subscription-hero p,
  .settings-hero p,
  .communication-hero p {
    font-size: 13px;
  }

  .excuse-card {
    padding: 14px;
  }

  .absence-selection-panel {
    padding: 12px;
  }

  .message-tabs,
  .sms-package-grid {
    grid-template-columns: 1fr 1fr;
  }

  .message-tab {
    min-height: 66px;
    font-size: 12px;
  }

  .message-alert-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .sub-stats,
  .subscription-grid,
  .plan-cards {
    grid-template-columns: 1fr;
  }

  .settings-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .settings-tab,
  .data-tab {
    min-height: 66px;
    font-size: 12px;
  }

  .subscription-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .sub-stat {
    min-height: 112px;
  }

  .sub-stat strong {
    font-size: 27px;
  }

  .subscription-detail-list div {
    align-items: flex-start;
    flex-direction: column;
  }

  .subscription-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .message-stat {
    min-height: 96px;
  }

  .send-summary-grid div,
  .send-confirm-grid div {
    min-height: 68px;
  }

  .template-helper {
    align-items: stretch;
    flex-direction: column;
  }

  .template-helper span {
    justify-content: center;
  }

  .dashboard-tab {
    min-height: 42px;
    padding: 8px;
    font-size: 12px;
  }

  .section-status-card,
  .pending-card,
  .absence-group,
  .panel,
  .role-card,
  .quick-action {
    border-radius: 10px;
  }

  .section-card-header,
  .absence-group-header,
  .pending-card {
    align-items: stretch;
    flex-direction: column;
  }

  .section-card-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section-card-stats div {
    min-width: 0;
  }

  .section-card-stats span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .section-card-actions,
  .student-chip-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar-field {
    min-width: 0;
  }

  .form-panel {
    max-width: none;
  }

  .wide,
  .setup-form button,
  .setup-checklist,
  .setup-section {
    grid-column: 1 / -1;
  }

  .student-check-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .no-absence-card {
    align-items: flex-start;
  }

  .student-check input,
  .no-absence-card input {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
  }

  .assigned-sections-field {
    padding: 14px 12px 12px;
  }

  .selected-sections-count {
    justify-self: stretch;
    text-align: center;
  }

  .form-grid .section-checkbox-grid {
    max-height: 42vh;
    gap: 8px;
    padding: 0 0 0 4px;
  }

  .form-grid .section-check {
    min-height: 48px;
    padding: 10px;
    border-radius: 10px;
    background: #f6f9fc;
  }

  .form-grid .section-check.is-selected {
    box-shadow: inset 5px 0 0 var(--brand-strong);
  }

  .table-wrap {
    overflow: visible;
  }

  .data-management-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .data-management-hero h2 {
    font-size: 21px;
    line-height: 1.45;
  }

  .data-management-hero p {
    font-size: 14px;
    line-height: 1.8;
  }

  .student-admin-stats {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .student-admin-stats article {
    min-height: 92px;
    padding: 12px;
  }

  .student-admin-stats strong {
    font-size: 27px;
  }

  .section-management-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .school-section-card {
    min-height: auto;
    padding: 15px;
  }

  .school-section-head h3 {
    font-size: 19px;
  }

  .school-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .school-section-meta {
    grid-template-columns: 1fr;
  }

  .school-section-meta div {
    min-height: 58px;
  }

  .section-management-actions,
  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  table,
  tbody,
  tr,
  td {
    width: 100%;
  }

  table {
    display: block;
    min-width: 0;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(180deg, #f7fafc, #eaf2f7);
    box-shadow: var(--shadow-soft);
  }

  td {
    display: grid;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 32px;
    padding: 0;
    border: 0;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  td:empty::after {
    content: "-";
    color: var(--muted);
  }

  .table-action,
  td .mini-button {
    width: 100%;
  }

  .row-badge {
    width: 28px;
    height: 28px;
    margin-left: 6px;
  }

  dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 16px;
    overflow: auto;
  }
}

@media (max-width: 430px) {
  .main {
    padding: 10px;
  }

  .topbar {
    margin: -10px -10px 12px;
    padding: 9px 10px;
  }

  .public-main,
  .public-header {
    width: min(100% - 18px, 1180px);
  }

  .public-hero h1,
  .dashboard-hero h2 {
    font-size: 22px;
  }

  .panel,
  .dashboard-hero-copy,
  .dashboard-score-card,
  .setup-card {
    padding: 12px;
  }

  #dashboardView .metrics-grid {
    grid-template-columns: 1fr;
  }

  #dashboardView .metric {
    min-height: 92px;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-rows: 1fr;
    align-items: center;
  }

  #dashboardView .metric strong {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    font-size: 30px;
  }

  .dashboard-tabs {
    grid-template-columns: 1fr;
  }

  .message-tabs,
  .sms-package-grid {
    grid-template-columns: 1fr;
  }

  .section-card-stats,
  .preview-cards {
    grid-template-columns: 1fr;
  }

  .recording-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .dialog-actions,
  .login-hint {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════
   لوحة اليوم — التصميم الجديد  (db-*)
═══════════════════════════════════════════════ */

/* ── رأس اللوحة ── */
.db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--line);
}

.db-header-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-strong);
  line-height: 1.2;
}

.db-header-date {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.db-filter {
  min-width: 170px;
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(16,38,63,0.06);
}

/* ── شريط تقدم الرصد ── */
.db-rec-card {
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(16,38,63,0.07);
}

.db-rec-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.db-rec-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.db-rec-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-strong);
}

.db-rec-desc {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.db-rec-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.db-rec-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.db-rec-stat svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.db-rec-stat--done {
  background: rgba(34,140,87,0.10);
  color: #1a7044;
  border: 1px solid rgba(34,140,87,0.20);
}

.db-rec-stat--pend {
  background: rgba(197,150,80,0.11);
  color: #9a6a32;
  border: 1px solid rgba(197,150,80,0.25);
}

.db-rec-track {
  height: 10px;
  background: #e8eef4;
  border-radius: 999px;
  overflow: hidden;
}

.db-rec-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #228c57, #14518e);
  transition: width 500ms cubic-bezier(.4,0,.2,1);
}

/* ── شريط التبويبات ── */
.db-tabs-wrap {
  margin-bottom: 14px;
}

.db-tabs-wrap .dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.db-tabs-wrap .dashboard-tab {
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 18px;
  background: #ffffff;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 800;
  transition: all 150ms ease;
}

.db-tabs-wrap .dashboard-tab:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.db-tabs-wrap .dashboard-tab.active {
  background: linear-gradient(135deg, #14518e 0%, #0d3560 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(20,81,142,0.30);
}

/* ── سجل الحالات ── */
.db-events-panel {
  margin-top: 4px;
}

/* ── بطاقات الصفوف (محدّثة) ── */
.section-status-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(16,38,63,0.06);
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.section-status-card:hover {
  box-shadow: 0 6px 18px rgba(16,38,63,0.11);
  transform: translateY(-2px);
}

.section-card-meter {
  height: 6px;
  background: #e8eef4;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.section-card-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c59650, #b93424);
  transition: width 400ms ease;
}

/* ── الاستجابة للشاشات الصغيرة (شبكة KPI تُدار بالكامل من الـ inline style) ── */
@media (max-width: 600px) {
  .db-rec-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .db-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .db-filter {
    width: 100%;
  }
}

/* ══════════════════════════════════════════
   لصق قائمة الطلاب + شارات الحالة
══════════════════════════════════════════ */
.hero-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end;margin-bottom:16px}
.field-optional{font-size:11px;font-weight:600;color:#8a98a8}

/* سمة hidden يجب أن تتغلّب على display:grid/flex للنماذج */
.dialog-form [hidden]{display:none !important}

.sections-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:14px}
.sections-toolbar-hint{margin:0;font-size:13px;color:#66778a;font-weight:600;line-height:1.6;flex:1;min-width:200px}
.add-class-preview{margin:2px 0 0;font-size:13px;font-weight:700;color:#1a7044;background:rgba(34,140,87,.08);border-radius:8px;padding:8px 12px;min-height:18px}
.add-class-preview:empty{display:none}

/* النافذة العريضة: التوسيع على عنصر dialog نفسه (وإلا قُصّ المحتوى عند 520px) */
dialog.dialog--wide{width:min(720px,calc(100vw - 28px));max-height:calc(100dvh - 40px);overflow:auto;padding:24px 26px;border-radius:14px}

.paste-header h2{margin:0 0 2px}
.paste-header .dialog-note{margin:0;font-size:13px;color:#66778a;line-height:1.7}

.paste-example{display:flex;align-items:flex-start;gap:10px;background:#f4f7fa;border:1px dashed #c8d6e3;border-radius:10px;padding:10px 14px}
.paste-example-label{flex-shrink:0;font-size:11px;font-weight:800;color:#14518e;background:rgba(20,81,142,.08);border-radius:999px;padding:3px 10px;margin-top:2px}
.paste-example-rows{display:grid;gap:3px;font-size:12.5px;color:#445566;line-height:1.7}
.paste-example-rows b{font-weight:700;color:#14518e;margin-inline-start:10px;direction:ltr;unicode-bidi:embed}
.paste-example-rows i{font-style:normal;color:#8a98a8;margin-inline-start:10px;font-size:11.5px}

.paste-actions{display:flex;align-items:center;gap:12px;margin:2px 0 4px;flex-wrap:wrap}
.paste-hint{font-size:12.5px;font-weight:700;color:#66778a}
#pasteStudentsInput{width:100%;box-sizing:border-box;font-family:inherit;font-size:14px;line-height:1.9;padding:10px 12px;border:1.5px solid #c8d6e3;border-radius:10px;resize:vertical;background:#fff}
#pasteStudentsInput:focus{outline:none;border-color:#14518e;box-shadow:0 0 0 3px rgba(20,81,142,.10)}
.paste-preview{max-height:280px;overflow:auto;border:1.5px solid #e1e8ef;border-radius:10px;margin-bottom:4px}
.paste-preview-table{width:100%;border-collapse:collapse;font-size:13px}
.paste-preview-table th,.paste-preview-table td{padding:7px 10px;text-align:right;border-bottom:1px solid #eef2f6}
.paste-preview-table td:nth-child(3){direction:ltr;text-align:right;unicode-bidi:embed}
.paste-preview-table thead th{position:sticky;top:0;background:#f4f7fa;font-weight:800;color:#445566;z-index:1}
.paste-row--warning{background:#fff8ec}
.paste-row--error{background:#fdecea}
.paste-row--dup{background:#f1f4f7;color:#8a98a8}
.pp-status{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:800;padding:2px 9px;border-radius:999px}
.pp-status--ready{background:rgba(34,140,87,.12);color:#1a7044}
.pp-status--warning{background:rgba(197,150,80,.16);color:#9a6a32}
.pp-status--error{background:rgba(185,52,36,.12);color:#b93424}
.pp-status--dup{background:rgba(102,119,138,.14);color:#5b6b7d}
.student-missing-badge{display:inline-block;margin-inline-start:8px;font-size:11px;font-weight:800;padding:2px 8px;border-radius:999px;background:rgba(197,150,80,.16);color:#9a6a32}
.student-disambig{display:inline-block;margin-inline-start:6px;font-weight:800;color:#14518e}

/* ══════════════════════════════════════════
   شريط التنقل السفلي — جوال فقط
══════════════════════════════════════════ */
.bottom-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  flex-direction: row;
  background: linear-gradient(90deg, #0e3760 0%, #14518e 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -4px 24px rgba(10, 40, 80, 0.45);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 4px 10px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-tab svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.bottom-tab.active {
  color: #d4a843;
}

.bottom-tab.active svg {
  stroke-width: 2.5;
}

@media (max-width: 767px) {
  .bottom-tab-bar {
    display: flex;
  }

  /* إخفاء زر القائمة في الشريط العلوي لأن الشريط السفلي يحل محله */
  .topbar--minimal .menu-button {
    display: none;
  }

  /* هامش سفلي للمحتوى لتجنب التداخل مع الشريط */
  .main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
}

/* ══════════════════════════════════════════
   الوضع الداكن (Dark mode)
══════════════════════════════════════════ */
:root[data-theme="dark"]{
  color-scheme: dark;
  --ice:#1b2735;
  --deep-blue:#7fb2ec;
  --mist-blue:#34465c;
  --sand-gold:#d4a45f;
  --bg:#0e1622;
  --surface:#16212f;
  --surface-2:#1b2735;
  --surface-3:#22303f;
  --surface-card:#172230;
  --surface-card-strong:#1f2c3b;
  --surface-tint:#1a2735;
  --ink:#e7eef5;
  --muted:#9fb1c4;
  --line:#2b3a4c;
  --brand:#2f6db5;
  --brand-strong:#7fb2ec;
  --brand-soft:#1b2a3c;
  --blue:#7fb2ec;
  --blue-strong:#9cc6f2;
  --gold:#d4a45f;
  --gold-strong:#e0b878;
  --orange:#d4a45f;
  --green:#45a878;
  --success:#45a878;
  --success-soft:#16301f;
  --danger:#e2745a;
  --danger-soft:#3a241c;
  --warning:#d9ad5e;
  --warning-soft:#352a1a;
  --info:#7fb2ec;
  --info-soft:#1b2a3c;
  --slate:#cdd9e6;
  --accent:#45a878;
  --gray:#34465c;
  --shadow-1:0 1px 3px rgba(0,0,0,.35);
  --shadow-2:0 2px 10px rgba(0,0,0,.38);
  --shadow-3:0 8px 28px rgba(0,0,0,.5);
  --shadow:var(--shadow-3);
  --shadow-soft:var(--shadow-2);
  --focus-ring:0 0 0 3px rgba(127,178,236,.30);

  /* رموز التقارير — الوضع الداكن */
  --rpt-navy:#12283f;
  --rpt-navy-sub:#8fabc6;
  --rpt-blue:#2f6db5;
  --rpt-blue-ink:#9cc6f2;
  --rpt-blue-soft:#1b2a3c;
  --rpt-gold:#e0b878;
  --rpt-gold-ink:#1c2733;
  --rpt-red:#e2745a;
  --rpt-red-ink:#f0a893;
  --rpt-red-soft:#3a241c;
  --rpt-amber:#d9ad5e;
  --rpt-amber-ink:#e8c98a;
  --rpt-amber-soft:#352a1a;
  --rpt-green:#45a878;
  --rpt-green-ink:#7cc9a0;
  --rpt-green-soft:#16301f;
  --rpt-line:#2b3a4c;
  --rpt-line-in:#25323f;
  --rpt-line-tight:#202c38;
  --rpt-zone:#172230;
  --rpt-zone-2:#141d29;
  --rpt-ink:#e7eef5;
  --rpt-ink-2:#c2d0de;
  --rpt-ink-mute:#9fb1c4;
  --rpt-ink-hint:#7488a0;
}

/* خلفية الصفحة */
[data-theme="dark"] body{
  background: linear-gradient(180deg,#101a28 0%,var(--bg) 100%);
}

/* الأزرار الأساسية */
[data-theme="dark"] .primary-button{ background:#2f6db5; }
[data-theme="dark"] .primary-button:hover{ background:#3d7cc4; }
[data-theme="dark"] .secondary-button{ background:var(--surface-2); color:var(--blue); border-color:var(--line); }
[data-theme="dark"] .secondary-button:hover{ background:var(--surface-3); }
[data-theme="dark"] .ghost-button{ background:var(--surface-2); color:var(--blue); border-color:var(--line); }
[data-theme="dark"] .ghost-button:hover{ background:var(--surface-3); border-color:var(--blue); }
[data-theme="dark"] .bottom-tab-bar{ background:linear-gradient(90deg,#0a2644 0%,#0e3760 100%); border-top-color:rgba(255,255,255,.08); }
[data-theme="dark"] .bottom-tab{ color:rgba(255,255,255,.45); }
[data-theme="dark"] .bottom-tab.active{ color:#d4a843; }

/* الحقول */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] #pasteStudentsInput{
  background:var(--surface-2);
  color:var(--ink);
  border-color:var(--line);
}
[data-theme="dark"] input:hover,
[data-theme="dark"] select:hover,
[data-theme="dark"] textarea:hover{ border-color:#3d5570; }
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus{ border-color:var(--blue); }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder{ color:#6b7d90; }
[data-theme="dark"] select option{ background:var(--surface-2); color:var(--ink); }

/* الأسطح البيضاء الثابتة في معالج الإعداد */
[data-theme="dark"] .setup-choice,
[data-theme="dark"] .grade-row label,
[data-theme="dark"] .section-status-card{
  background:var(--surface-card);
  border-color:var(--line);
}

/* الحوارات */
[data-theme="dark"] dialog{ background:var(--surface); color:var(--ink); }
[data-theme="dark"] .paste-example{ background:var(--surface-2); border-color:var(--line); }
[data-theme="dark"] .paste-preview,
[data-theme="dark"] .paste-preview-table th,
[data-theme="dark"] .paste-preview-table td{ border-color:var(--line); }
[data-theme="dark"] .paste-preview-table thead th{ background:var(--surface-3); color:var(--ink); }
[data-theme="dark"] .paste-row--warning{ background:#2a2415; }
[data-theme="dark"] .paste-row--error{ background:#321d1a; }
[data-theme="dark"] .paste-row--dup{ background:#1d2733; }
[data-theme="dark"] .add-class-preview{ background:rgba(52,140,87,.14); color:#8fe0b0; }

/* الجداول */
[data-theme="dark"] table th{ background:var(--surface-3); color:var(--ink); }
[data-theme="dark"] table td{ border-color:var(--line); }

/* ── لوحة اليوم (الأنماط المضمّنة تستخدم ألواناً ثابتة) ── */
[data-theme="dark"] .db-header{ border-color:var(--line); }
[data-theme="dark"] .db-header-title{ color:var(--deep-blue); }
[data-theme="dark"] .db-header-date{ color:var(--muted); }
[data-theme="dark"] .db-filter{ background:var(--surface-2)!important; color:var(--ink); }
[data-theme="dark"] .db-rec-card{ background:var(--surface-card); border-color:var(--line); }
[data-theme="dark"] .db-rec-desc{ color:var(--muted); }
[data-theme="dark"] .db-rec-title{ color:var(--deep-blue); }
[data-theme="dark"] .db-rec-track{ background:var(--surface-3); }
[data-theme="dark"] .db-toolbar-label{ color:var(--muted); }
[data-theme="dark"] .db-filter{ background:var(--surface-2)!important; color:var(--ink); border-color:var(--line); }

/* مكوّنات المرحلة 2 — الوضع الداكن */
[data-theme="dark"] .empty-state-icon{ background:rgba(127,178,236,.14); color:#7fb2ec; }
[data-theme="dark"] .empty-state strong{ color:var(--ink); }
[data-theme="dark"] .no-absence-card{ background:rgba(69,168,120,.12); border-color:rgba(69,168,120,.30); }
[data-theme="dark"] .no-absence-card strong{ color:#7fd0a3; }
[data-theme="dark"] .no-absence-card small{ color:#9fc7b2; }
[data-theme="dark"] .student-check{ background:transparent; border-bottom-color:var(--line); }
[data-theme="dark"] .student-check:hover{ background:rgba(127,178,236,.10); }
[data-theme="dark"] .student-check:has(input:checked){ background:rgba(226,116,90,.16); }
[data-theme="dark"] .student-check:has(input:checked) span{ color:#e2745a; }
[data-theme="dark"] .student-check-grid{ border-top-color:var(--line); }
[data-theme="dark"] .late-batch-bar{ background:rgba(255,255,255,.04); border-bottom-color:var(--line); }
[data-theme="dark"] .late-batch-count{ color:var(--muted); }

[data-theme="dark"] .late-student-grid .student-check:has(input:checked){ background:rgba(212,168,67,.15); border-bottom-color:rgba(212,168,67,.38); }
[data-theme="dark"] .late-student-grid .student-check:has(input:checked) span{ color:#d4a843; }
[data-theme="dark"] .late-batch-fields{ border-top-color:var(--line); }
[data-theme="dark"] .student-picker-list{ background:var(--surface-2); border-color:var(--line); }
[data-theme="dark"] .student-picker-option{ border-bottom-color:var(--line); color:var(--ink); }
[data-theme="dark"] .student-picker-option:hover{ background:rgba(127,178,236,.10); }
[data-theme="dark"] .student-picker-option.is-selected{ background:rgba(127,178,236,.18); color:#cfe0f5; }
[data-theme="dark"] .student-picker-option .spo-check{ color:#7fb2ec; }
[data-theme="dark"] .record-actions{ background:var(--surface-card); border-color:var(--line); }

/* بطاقتا التحكم في الرصد — الوضع الداكن */
[data-theme="dark"] .rec-control--date{ background:rgba(127,178,236,.10); border-color:rgba(127,178,236,.25); }
[data-theme="dark"] .rec-control--date .rec-control-label{ color:#9cc6f2; }
[data-theme="dark"] .rec-control--class{ background:rgba(69,168,120,.12); border-color:rgba(69,168,120,.28); }
[data-theme="dark"] .rec-control--class .rec-control-label{ color:#7fd0a3; }
[data-theme="dark"] .rec-control input,
[data-theme="dark"] .rec-control select{ color:var(--ink); }
[data-theme="dark"] .rec-control--class .rec-control-value{ color:var(--ink); }
[data-theme="dark"] .rec-control-caret{ color:#7fd0a3; }

/* منتقي الصف — الوضع الداكن */
[data-theme="dark"] .picker-dialog{ background:var(--surface); border-color:var(--line); }
[data-theme="dark"] .picker-head{ border-bottom-color:var(--line); }
[data-theme="dark"] .picker-close{ background:var(--surface-2); border-color:var(--line); }
[data-theme="dark"] .picker-option{ color:var(--ink); }
[data-theme="dark"] .picker-option:hover{ background:rgba(127,178,236,.10); }
[data-theme="dark"] .picker-option.is-selected{ background:rgba(69,168,120,.16); border-color:rgba(69,168,120,.30); color:#7fd0a3; }
[data-theme="dark"] .picker-option-check{ color:#5cc08a; }

/* مكوّنات المرحلة 3 — الوضع الداكن */
[data-theme="dark"] .data-management-hero,
[data-theme="dark"] .settings-hero,
[data-theme="dark"] .role-card{ background:var(--surface-card); border-color:var(--line); color:var(--ink); }
[data-theme="dark"] .data-management-hero span{ color:#7fb2ec; }
[data-theme="dark"] .settings-hero .dashboard-kicker{ background:rgba(127,178,236,.14); color:#7fb2ec; border-color:rgba(127,178,236,.25); }
[data-theme="dark"] .data-management-hero h2,
[data-theme="dark"] .settings-hero h2{ color:var(--ink); }
[data-theme="dark"] .student-admin-stats article{ background:var(--surface-2); }
[data-theme="dark"] .student-admin-stats strong{ color:var(--ink); }
[data-theme="dark"] .settings-tab.active,
[data-theme="dark"] .message-tab.active,
[data-theme="dark"] .data-tab.active{ background:#2f6db5; color:#fff; border-color:#2f6db5; box-shadow:0 8px 18px rgba(0,0,0,.35); }

/* التبويبات الأيقونية غير النشطة: --surface-card فاتح ولا يُعرَّف داكنًا */
[data-theme="dark"] .icon-tabs .settings-tab,
[data-theme="dark"] .icon-tabs .message-tab,
[data-theme="dark"] .icon-tabs .data-tab{ background:var(--surface-2); border-color:var(--line); color:var(--muted); }
[data-theme="dark"] .icon-tabs .settings-tab.active,
[data-theme="dark"] .icon-tabs .message-tab.active,
[data-theme="dark"] .icon-tabs .data-tab.active{ background:#2f6db5; border-color:#2f6db5; color:#fff; }
[data-theme="dark"] .icon-tabs .settings-tab:hover:not(.active),
[data-theme="dark"] .icon-tabs .message-tab:hover:not(.active),
[data-theme="dark"] .icon-tabs .data-tab:hover:not(.active){ border-color:#7fb2ec; color:var(--ink); }

/* معاينة الرد في الجدول: زر نصي يفتح التفاصيل الكاملة */
.comm-reply-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: right;
  cursor: pointer;
}

.comm-reply-preview:hover { color: var(--brand-strong); }

.comm-reply-more {
  display: inline-block;
  margin-inline-start: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-strong);
  text-decoration: underline;
  white-space: nowrap;
}

/* نافذة تفاصيل الطلب والرد الكامل */
.comm-details-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: min(92vw, 620px);
  width: 100%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

.comm-details-dialog::backdrop { background: rgba(10, 20, 32, .55); }

.comm-details-body { padding: 18px; display: grid; gap: 12px; }

.comm-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comm-details-head h3 { margin: 0; font-size: 16px; color: var(--ink); }
.comm-details-head small { color: var(--muted); font-weight: 700; }

.comm-details-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
}

.comm-details-timeline > div {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8fb;
  display: grid;
  gap: 2px;
}

.comm-details-timeline span { font-size: 10.5px; font-weight: 800; color: var(--muted); }
.comm-details-timeline strong { font-size: 12.5px; color: var(--ink); }

.comm-details-reply {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fafc;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.comm-details-reply > span { font-size: 11.5px; font-weight: 800; color: var(--muted); }

.comm-details-reply p {
  margin: 0;
  max-height: 42vh;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="dark"] .comm-details-dialog { background: var(--surface-2); }
[data-theme="dark"] .comm-details-timeline > div,
[data-theme="dark"] .comm-details-reply { background: rgba(255,255,255,.04); border-color: var(--line); }

/* عارض مرفق التبرير */
.comm-attachment-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: min(92vw, 560px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

.comm-attachment-dialog::backdrop { background: rgba(10, 20, 32, .55); }

.comm-attachment-body { padding: 18px; display: grid; gap: 14px; }
.comm-attachment-body h3 { margin: 0; font-size: 15px; color: var(--ink); }
.comm-attachment-body img {
  max-width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f4f8fb;
  justify-self: center;
}
.comm-attachment-body .dialog-actions a { text-decoration: none; text-align: center; }

[data-theme="dark"] .comm-attachment-dialog { background: var(--surface-2); }
[data-theme="dark"] .comm-attachment-body h3 { color: var(--ink); }
[data-theme="dark"] .comm-attachment-body img { background: var(--surface-1, #121c29); border-color: var(--line); }

/* مركز التواصل — الوضع الداكن */
[data-theme="dark"] .excuse-days-list > span,
[data-theme="dark"] .excuse-day-check{ background:var(--surface-2); border-color:var(--line); color:var(--ink); }
[data-theme="dark"] .comm-student-card{ background:var(--surface-2); border-color:var(--line); }
[data-theme="dark"] .comm-student-facts > div{ background:rgba(255,255,255,.04); border-color:var(--line); }
[data-theme="dark"] .comm-student-facts strong{ color:#7fb2ec; }
[data-theme="dark"] .comm-dates-cell span{ background:var(--surface-2); border-color:var(--line); color:var(--ink); }
[data-theme="dark"] .excuse-day-check.is-selected{ background:rgba(127,178,236,.14); border-color:#7fb2ec; }
[data-theme="dark"] .role-card > span{ background:rgba(127,178,236,.14); border-color:rgba(127,178,236,.25); color:#7fb2ec; }

/* بطاقات الفصول */
[data-theme="dark"] .student-disambig{ color:var(--deep-blue); }

/* طبقة المحتوى الرئيسية (كانت تتلوّن بتدرّج فاتح) */
[data-theme="dark"] .main{
  background: linear-gradient(180deg, rgba(22,33,47,.55), rgba(14,22,34,.30));
}

/* أزرار تبويب لوحة اليوم غير النشطة */
[data-theme="dark"] .dashboard-tab{ background:var(--surface-2); color:var(--blue); }

/* البطاقات ذات التدرّج الفاتح الثابت */
[data-theme="dark"] .section-status-card,
[data-theme="dark"] .pending-card,
[data-theme="dark"] .absence-group{
  background: linear-gradient(145deg, var(--surface-card-strong), var(--surface-card));
  border-color: var(--line);
}

/* تذييل الشريط الجانبي (يبقى ضمن الشريط الداكن) */
[data-theme="dark"] .sidebar-footer{
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border-color: rgba(255,255,255,.12);
}

/* أسطح بيضاء متفرّقة */
[data-theme="dark"] .setup-checklist span,
[data-theme="dark"] .school-section-card,
[data-theme="dark"] .panel,
[data-theme="dark"] .data-table,
[data-theme="dark"] .data-table tbody tr{ background-color:var(--surface-card); }
[data-theme="dark"] .data-table tbody tr:nth-child(even){ background-color:var(--surface-2); }

/* ── تجاوزات عالية التحديد لمواجهة الأنماط المضمّنة (تأتي بعد الملف) ── */
/* بطاقة الصف في لوحة اليوم (مضمّنة بـ !important) */
html[data-theme="dark"] .section-status-card{
  background:var(--surface-card)!important;
  border-color:var(--line)!important;
  box-shadow:0 2px 10px rgba(0,0,0,.35)!important;
}
html[data-theme="dark"] .section-card-stats > div{ background:var(--surface-2); border-color:var(--line); }
html[data-theme="dark"] .section-card-stats span{ color:var(--muted); }
html[data-theme="dark"] .section-card-meter{ background:var(--surface-3); }
/* أزرار تبويب لوحة اليوم (مضمّنة بتحديد .db-tabs-wrap) */
html[data-theme="dark"] .db-tabs-wrap .dashboard-tab{ background:var(--surface-2); color:var(--blue); border-color:var(--line); }
html[data-theme="dark"] .db-tabs-wrap .dashboard-tab:hover{ background:var(--surface-3); border-color:var(--blue); }
html[data-theme="dark"] .db-tabs-wrap .dashboard-tab.active{ color:#fff; }
/* أزرار صغيرة وشارات */
html[data-theme="dark"] .mini-button{ background:var(--surface-2); color:var(--blue); }
html[data-theme="dark"] .status-pill{ background:var(--surface-2); color:var(--muted); }
/* عناصر فاتحة أخرى داخل التطبيق */
html[data-theme="dark"] .message-tab,
html[data-theme="dark"] .template-helper,
html[data-theme="dark"] .absence-selection-panel,
html[data-theme="dark"] .section-check,
html[data-theme="dark"] .selected-sections-count{ background:var(--surface-card); border-color:var(--line); color:var(--ink); }

/* ── الشريط الجانبي (تصميم مضمّن فاتح بـ !important) ── */
html[data-theme="dark"] .sidebar{
  background:linear-gradient(180deg,#111a26 0%,#0d141e 100%)!important;
  color:var(--ink)!important;
  border-left:1px solid var(--line)!important;
  box-shadow:-1px 0 0 var(--line)!important;
}
html[data-theme="dark"] .brand{ background:var(--surface-2)!important; border-color:var(--line)!important; box-shadow:none!important; }
html[data-theme="dark"] .brand strong{ color:var(--ink)!important; }
html[data-theme="dark"] .brand span{ color:var(--muted)!important; }
html[data-theme="dark"] .nav-group-label{ color:#758799!important; }
html[data-theme="dark"] .nav-group-secondary{ border-top-color:var(--line)!important; }
html[data-theme="dark"] .nav-item{ color:#aebccb!important; }
html[data-theme="dark"] .nav-item:hover{ background:rgba(127,178,236,.10)!important; color:var(--blue)!important; }
html[data-theme="dark"] .nav-item.active{ background:rgba(127,178,236,.14)!important; color:var(--blue)!important; border-color:rgba(127,178,236,.20)!important; }
html[data-theme="dark"] .nav-icon{ background:var(--surface-3)!important; color:var(--muted)!important; }
html[data-theme="dark"] .nav-item:hover .nav-icon{ background:rgba(127,178,236,.16)!important; color:var(--blue)!important; }
html[data-theme="dark"] .sidebar-footer{ background:var(--surface-2)!important; border-color:var(--line)!important; box-shadow:none!important; }
html[data-theme="dark"] .sidebar-footer strong{ color:var(--blue)!important; }
html[data-theme="dark"] .sidebar-footer span{ color:var(--muted)!important; }
html[data-theme="dark"] .sidebar-link{ color:var(--muted)!important; }
html[data-theme="dark"] .sidebar-link:hover{ color:var(--blue)!important; }
html[data-theme="dark"] .sidebar-user{ background:var(--surface-2)!important; border-color:var(--line)!important; box-shadow:none!important; }
html[data-theme="dark"] .sidebar-user-school{ color:var(--ink)!important; }
html[data-theme="dark"] .sidebar-user-greeting{ color:#7fb2ec!important; }
html[data-theme="dark"] .sidebar-user-role{ color:var(--muted)!important; }
html[data-theme="dark"] .sidebar-user-initials{ box-shadow:0 2px 8px rgba(20,81,142,.4)!important; }
html[data-theme="dark"] .sidebar-logout-btn{ border-color:var(--line)!important; color:var(--muted)!important; }
html[data-theme="dark"] .sidebar-logout-btn:hover{ background:rgba(248,113,113,.08)!important; border-color:rgba(248,113,113,.2)!important; color:#f87171!important; }
html[data-theme="dark"] .db-detail-filter-label{ color:#758799!important; }
html[data-theme="dark"] .db-detail-filter .db-filter{ background:var(--surface-2)!important; color:var(--ink)!important; border-color:var(--line)!important; }
html[data-theme="dark"] .db-kpi--rec{ background:linear-gradient(180deg,#1a2535 0%,#131e2c 100%)!important; }
html[data-theme="dark"] .db-rec-split-label{ color:#9fb1c4!important; }
html[data-theme="dark"] .db-rec-split-sep{ background:var(--line)!important; }
html[data-theme="dark"] .db-rec-split--done .db-rec-split-ic{ background:rgba(69,168,120,.16)!important; color:#5cc08a!important; }
html[data-theme="dark"] .db-rec-split--done .db-rec-split-num{ color:#5cc08a!important; }
html[data-theme="dark"] .db-rec-split--pend .db-rec-split-ic{ background:rgba(197,150,80,.16)!important; color:#dcb16a!important; }
html[data-theme="dark"] .db-rec-split--pend .db-rec-split-num{ color:#dcb16a!important; }
html[data-theme="dark"] .db-events-wrap{ border-color:rgba(127,178,236,.12)!important; box-shadow:0 8px 28px rgba(0,0,0,.38),0 2px 6px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.04)!important; }

/* صناديق العناصر الداخلية الفاتحة (رسائل/اشتراك/بيانات) */
html[data-theme="dark"] .db-tabs-wrap .dashboard-tabs,
html[data-theme="dark"] .send-summary-grid > div,
html[data-theme="dark"] .message-policy-list > div,
html[data-theme="dark"] .subscription-detail-list > div,
html[data-theme="dark"] .subscription-policy-list > div,
html[data-theme="dark"] .school-section-meta > div,
html[data-theme="dark"] .template-helper span,
html[data-theme="dark"] .invoice-row,
html[data-theme="dark"] .report-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .send-detail,
html[data-theme="dark"] .summary-card{
  background:var(--surface-2)!important;
  border-color:var(--line);
  color:var(--ink);
}

html[data-theme="dark"] .send-detail summary{ color:var(--ink); }

/* زر تبديل الوضع */
:root{
  --moon:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/></svg>");
  --sun:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='5'/><line x1='12' y1='1' x2='12' y2='3'/><line x1='12' y1='21' x2='12' y2='23'/><line x1='4.22' y1='4.22' x2='5.64' y2='5.64'/><line x1='18.36' y1='18.36' x2='19.78' y2='19.78'/><line x1='1' y1='12' x2='3' y2='12'/><line x1='21' y1='12' x2='23' y2='12'/><line x1='4.22' y1='19.78' x2='5.64' y2='18.36'/><line x1='18.36' y1='5.64' x2='19.78' y2='4.22'/></svg>");
}
.theme-toggle{
  display:flex;align-items:center;gap:9px;width:100%;justify-content:center;
  background:rgba(255,255,255,.08);color:#fff;border:1px solid rgba(234,239,243,.16);
  border-radius:9px;padding:9px 12px;font-size:13px;font-weight:700;margin-bottom:12px;
  transition:background-color 150ms ease;
}
.theme-toggle:hover{ background:rgba(255,255,255,.14); }
.theme-toggle-icon{ width:16px;height:16px;flex-shrink:0;background:currentColor;
  -webkit-mask:center/contain no-repeat var(--moon);mask:center/contain no-repeat var(--moon); }
[data-theme="dark"] .theme-toggle-icon{
  -webkit-mask-image:var(--sun);mask-image:var(--sun);
}
