:root {
  --teal-900: #164e4a;
  --teal-800: #1d5f5a;
  --teal-700: #23716b;
  --teal-600: #2b8a82;
  --teal-500: #3aa198;
  --teal-100: #e3f2f0;
  --teal-50: #f2f9f8;
  --bg: #f4f6f6;
  --card: #ffffff;
  --ink: #1f2d2c;
  --muted: #6b7b7a;
  --line: #e2e8e7;
  --danger: #b4423a;
  --warn: #b26a00;
  --ok: #1f8a5b;
  --wa: #1fa855;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 40, 38, .06), 0 4px 16px rgba(16, 40, 38, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; }
h3 { font-size: var(--fs-lg); color: var(--teal-900); }
p { margin: 0 0 .5rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.ok { color: var(--ok); font-weight: 700; }
.warn { color: var(--warn); font-weight: 700; }
[hidden] { display: none !important; }

/* ---------- الهيكل ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 270px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--teal-800), var(--teal-600));
  color: #fff; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 1.25rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand h1 { font-size: var(--fs-xl); font-weight: 800; }
.brand p { font-size: var(--fs-sm); opacity: .85; }
.side nav { display: flex; flex-direction: column; gap: .3rem; border-top: 1px solid rgba(255,255,255,.18); padding-top: 1rem; }
.side nav a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  color: #fff; padding: .6rem .8rem; border-radius: 10px; font-weight: 500;
}
.side nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.side nav a.on { background: #fff; color: var(--teal-800); font-weight: 700; }
.side nav small {
  font-size: var(--fs-xs); padding: .05rem .5rem; border-radius: 99px;
  background: rgba(255,255,255,.18); white-space: nowrap;
}
.side nav a.on small { background: var(--teal-100); color: var(--teal-700); }
.me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.18); padding-top: 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.me div { width: 100%; display: flex; flex-direction: column; }
.me span { font-size: var(--fs-xs); opacity: .8; }
.me a { color: #fff; font-size: var(--fs-sm); opacity: .9; }

.main { flex: 1; min-width: 0; padding: 1.75rem 2rem 3rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head h2 { font-size: var(--fs-2xl); color: var(--teal-900); font-weight: 800; }
.head p { color: var(--muted); }
.week-pick { display: flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); }
.week-pick select { max-width: 340px; }
.menu-btn { display: none; }

/* ---------- عناصر عامة ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; border: 1px solid var(--line);
}
.card.narrow { max-width: 480px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-head h3 { margin: 0; }
.card.note { border-inline-start: 4px solid var(--teal-500); background: var(--teal-50); }
.card.note p { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }
.card.empty h2 { color: var(--teal-900); }

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash.success { background: #e5f5ec; color: #17633f; border: 1px solid #bfe3cf; }
.flash.info { background: #fff6e0; color: #7a5300; border: 1px solid #f1dca4; }
.flash.error { background: #fbeceb; color: #8f2f28; border: 1px solid #f0c9c5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  background: var(--teal-700); color: #fff; border: 0; border-radius: 10px;
  padding: .6rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--teal-800); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: .35rem .8rem; font-size: var(--fs-sm); border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--teal-700); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--teal-50); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #f0c9c5; }
.btn.danger:hover { background: #fbeceb; }
.btn.wa { background: var(--wa); }
.btn.wa:hover { background: #178a45; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-100); border-color: var(--teal-500); }
textarea { width: 100%; resize: vertical; }
.form { display: flex; flex-direction: column; gap: .9rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: var(--fs-sm); }
.form.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem 1.25rem; }
.form .full, .form .row { grid-column: 1 / -1; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .4rem; font-weight: 400 !important; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* الإحصاءات */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: var(--fs-3xl); font-weight: 800; color: var(--teal-800); line-height: 1.1; }
.stat span { color: var(--muted); font-size: var(--fs-sm); }

/* حالة الطلاب */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.status-item { display: block; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; color: inherit; }
.status-item:hover { border-color: var(--teal-500); text-decoration: none; }
.si-top { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.si-top strong { display: block; }
.bar { height: 6px; background: var(--teal-100); border-radius: 99px; overflow: hidden; margin-top: .6rem; }
.bar i { display: block; height: 100%; background: var(--teal-600); border-radius: 99px; }

.badge { display: inline-block; font-size: var(--fs-xs); font-weight: 700; padding: .15rem .6rem; border-radius: 99px; white-space: nowrap; background: #eef1f1; color: var(--muted); }
.st-waiting, .ln-expired { background: #fdf0e1; color: var(--warn); }
.st-progress { background: #e8f1fb; color: #2a65a8; }
.st-opinions { background: #f3ecfb; color: #6a42a8; }
.st-ready, .ln-active { background: #e5f5ec; color: var(--ok); }
.st-sent, .ln-completed { background: var(--teal-100); color: var(--teal-800); }
.st-noteachers, .ln-revoked { background: #fbeceb; color: var(--danger); }

.grade { display: inline-block; font-size: var(--fs-xs); font-weight: 700; padding: .1rem .55rem; border-radius: 6px; }
.g4 { background: #e5f5ec; color: #17633f; }
.g3 { background: #e8f1fb; color: #2a65a8; }
.g2 { background: #fdf6e1; color: #8a6200; }
.g1 { background: #fbeceb; color: #8f2f28; }

/* الجداول */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: var(--fs-sm); color: var(--muted); font-weight: 700; background: #fafbfb; }
tr.inactive td { opacity: .5; }

/* اختيار الطلاب */
.picker { background: var(--teal-50); border: 1px dashed var(--teal-500); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .4rem; max-height: 340px; overflow-y: auto; }
.pick { display: grid; grid-template-columns: auto 1fr; gap: 0 .5rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; cursor: pointer; }
.pick small { grid-column: 2; color: var(--muted); font-size: var(--fs-xs); }
.pick.dim { opacity: .5; cursor: default; }
.pick:has(input:checked:not(:disabled)) { border-color: var(--teal-600); background: var(--teal-100); }

/* ملف الطالب */
.profile { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.profile h3 { font-size: var(--fs-xl); margin-top: .3rem; }
.tag { display: inline-block; font-size: var(--fs-xs); color: #2a65a8; background: #e8f1fb; padding: .1rem .55rem; border-radius: 6px; }
.list { margin: 0; padding-inline-start: 1.2rem; }
.list li { margin-bottom: .35rem; }

/* التبويبات */
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem 1.1rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; }
.tabs a.on { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.tabs a:hover { text-decoration: none; }
.tabs.inline { margin: 0; }
.tabs.inline a { padding: .3rem .8rem; font-size: var(--fs-sm); }

.split { display: grid; grid-template-columns: 260px 1fr; gap: 1.25rem; align-items: start; }
.side-list { padding: 1rem; }
.side-list a { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .6rem; border-radius: 8px; color: inherit; }
.side-list a:hover { background: var(--teal-50); text-decoration: none; }
.side-list a.on { background: var(--teal-100); font-weight: 700; }
.summary { background: var(--teal-50); border-radius: 10px; padding: .9rem 1rem; margin: .75rem 0 1rem; border-inline-start: 3px solid var(--teal-500); }
.summary details { margin-top: .4rem; }
.quote { background: #fafbfb; border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; }

/* الروابط */
details.more { position: relative; }
details.more summary { list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
.more-box { position: absolute; inset-inline-end: 0; top: 110%; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: .75rem; display: flex; flex-direction: column; gap: .5rem; min-width: 280px; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--teal-50); border: 1px solid var(--teal-100); border-radius: 99px; padding-block: .2rem; padding-inline: .4rem .7rem; font-size: var(--fs-sm); margin: 0; }
.chip button { border: 0; background: none; color: var(--danger); font-size: var(--fs-lg); cursor: pointer; line-height: 1; }

/* ---------- نموذج التقييم ---------- */
.eval-progress { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.eval-progress .bar { flex: 1; margin: 0; }
.eval-student h3 { margin-bottom: .75rem; }
.eval-subject { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; margin-bottom: .75rem; }
.eval-subject.is-done { border-color: #bfe3cf; background: #fbfefc; }
.es-title { font-weight: 700; color: var(--teal-900); margin-bottom: .5rem; }
.choices { border: 0; padding: 0; margin: 0 0 .6rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.choices legend { font-size: var(--fs-sm); color: var(--muted); padding: 0; margin-bottom: .3rem; width: 100%; }
.choice { cursor: pointer; background: none !important; padding: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-block; padding: .4rem .9rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: var(--fs-sm); }
.choice input:focus-visible + span { outline: 2px solid var(--teal-500); }
.choice.g4 input:checked + span { background: #1f8a5b; border-color: #1f8a5b; color: #fff; }
.choice.g3 input:checked + span { background: #2a65a8; border-color: #2a65a8; color: #fff; }
.choice.g2 input:checked + span { background: #b88600; border-color: #b88600; color: #fff; }
.choice.g1 input:checked + span { background: #b4423a; border-color: #b4423a; color: #fff; }
.note-field { display: flex; flex-direction: column; gap: .3rem; font-size: var(--fs-sm); color: var(--muted); }
.sticky-save { position: sticky; bottom: 0; background: rgba(244,246,246,.95); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); padding: .9rem 0; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- الصفحات العامة ---------- */
body.public { background: var(--bg); }
.auth-box { max-width: 420px; margin: 8vh auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; border-top: 6px solid var(--teal-600); }
.auth-box h1 { color: var(--teal-900); font-size: var(--fs-xl); }
.auth-box .btn { width: 100%; margin-top: .25rem; }
.public-wrap { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.public-head { background: linear-gradient(135deg, var(--teal-800), var(--teal-600)); color: #fff; border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.public-head h1 { font-size: var(--fs-xl); }
.public-head p { margin: 0; opacity: .85; }
.hello { font-size: var(--fs-base); }
.print-bar { display: flex; justify-content: flex-start; margin-bottom: 1rem; }

/* ---------- التقرير ---------- */
/* هوية التقرير: شريط علوي داكن + لسان اسم المدرسة + شريط عنوان + تذييل أخضر */
.report {
  --rp-dark: #173643; --rp-sage: #77a17d; --rp-sage-l: #cadbcc; --rp-sage-m: #b0c6b1; --rp-line: #dde6e2;
  background: #fff; max-width: 820px; margin: 0 auto 1.5rem; box-shadow: 0 2px 14px rgba(23, 54, 67, .12);
  display: flex; flex-direction: column; overflow: hidden; color: #1f2d2c;
}
.rp-bar {
  background: var(--rp-dark); color: #fff; display: flex; align-items: center; gap: 1.5rem;
  min-height: 92px; padding-block: 14px; padding-inline: 30px 40px; border-end-end-radius: 56px;
}
.rp-logo { flex-shrink: 0; min-width: 70px; display: flex; align-items: center; }
.rp-logo img { max-height: 70px; max-width: 120px; display: block; }
.rp-dept { flex: 1; text-align: center; font-weight: 800; font-size: var(--fs-xl); letter-spacing: .02em; }
.rp-school {
  width: fit-content; margin: 0 auto; background: var(--rp-dark); color: #fff; font-weight: 700;
  font-size: var(--fs-md); padding: 6px 46px 10px; border-radius: 0 0 16px 16px; text-align: center;
}
.rp-titleband {
  margin: 26px 38px 6px; background: var(--rp-dark); color: #fff; text-align: center;
  padding: 16px 20px 14px; border-radius: 4px; box-shadow: 0 8px 0 -4px var(--rp-sage-l);
}
.rp-titleband h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 800; color: #fff; }
.rp-titleband span { display: block; font-size: var(--fs-sm); color: #cfe0d9; margin-top: .2rem; }
.rp-body { padding: 18px 38px 26px; flex: 1; }
.rp-intro { color: #4f5f5e; text-align: center; max-width: 640px; margin: 0 auto 1.1rem; font-size: var(--fs-md); }
.rp-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: 0 0 1.1rem; }
.rp-info div { background: #f4f8f5; border: 1px solid var(--rp-line); border-inline-start: 4px solid var(--rp-sage); border-radius: 6px; padding: .5rem .85rem; }
.rp-info dt { font-size: var(--fs-xs); color: #6b7b7a; }
.rp-info dd { margin: 0; font-weight: 800; color: var(--rp-dark); }
.rp-table { border: 1px solid var(--rp-line); }
.rp-table th { background: var(--rp-dark); color: #fff; text-align: center; font-size: var(--fs-sm); padding: .6rem .5rem; border: 0; }
.rp-table td { text-align: center; border-bottom: 1px solid var(--rp-line); padding: .5rem; }
.rp-table tbody tr:nth-child(even) td { background: #f6f9f7; }
.rp-table td.rp-subj { font-weight: 700; color: var(--rp-dark); text-align: start; }
.rp-opinions { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1.1rem; }
.rp-opinion { border: 1px solid var(--rp-line); border-top: 4px solid var(--rp-sage); border-radius: 6px; padding: .6rem .9rem; background: #fff; }
.rp-opinion h4 { color: var(--rp-dark); margin: 0 0 .3rem; font-size: var(--fs-md); }
.rp-opinion p { margin: 0; font-size: var(--fs-md); }
.rp-closing { text-align: center; color: #4d7a55; margin-top: 1.2rem; font-weight: 500; }
.rp-sign { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.4rem; text-align: center; }
.rp-sign div { display: flex; flex-direction: column; gap: .15rem; }
.rp-sig { height: 58px; display: flex; align-items: flex-end; justify-content: center; font-style: normal; }
.rp-sig img { max-height: 58px; max-width: min(170px, 100%); height: auto; display: block; }
.rp-sign span { color: var(--rp-dark); font-weight: 700; font-size: var(--fs-sm); }
.rp-sign b { border-top: 1px dotted #8a9a98; padding-top: .35rem; min-height: 1.9rem; font-weight: 500; font-size: var(--fs-sm); }
.rp-foot { display: flex; align-items: stretch; min-height: 46px; margin-top: auto; }
.rp-foot-logo { width: 96px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #fff; }
.rp-foot-logo img { max-height: 36px; max-width: 84px; }
.rp-foot-logo img.tint { filter: brightness(0) saturate(100%) invert(56%) sepia(14%) saturate(800%) hue-rotate(76deg); }
.rp-foot-bar {
  flex: 1; display: flex; align-items: center; padding: 0 18px;
  background: linear-gradient(90deg, var(--rp-sage) 0%, var(--rp-sage-l) 45%, var(--rp-sage-l) 60%, var(--rp-sage) 100%);
  box-shadow: inset 0 6px 0 var(--rp-sage-m);
}
.rp-foot-bar span { color: #fff; font-size: var(--fs-sm); font-weight: 500; text-shadow: 0 1px 2px rgba(23, 54, 67, .45); padding-top: 4px; }
.logo-row { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { width: 170px; height: 90px; background: #173643; border-radius: 0 0 0 28px; display: flex; align-items: center; justify-content: center; }
.logo-preview img { max-height: 64px; max-width: 150px; }
.logo-preview .muted { color: #cfe0d9; }

/* ---------- الجوال ---------- */
@media (max-width: 900px) {
  .side { position: fixed; inset: 0 0 0 auto; z-index: 50; transform: translateX(100%); transition: transform .2s; box-shadow: -8px 0 24px rgba(0,0,0,.2); }
  .side.open { transform: none; }
  .main { padding: 1rem 16px 3rem; }
  .menu-btn { display: inline-flex; position: fixed; top: 12px; inset-inline-end: 12px; z-index: 60; background: var(--teal-700); color: #fff; border: 0; border-radius: 10px; width: 42px; height: 42px; font-size: var(--fs-xl); align-items: center; justify-content: center; }
  .head h2 { font-size: var(--fs-xl); padding-inline-end: 50px; }
  .split, .form.grid2 { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr; }
  .more-box { position: static; min-width: 0; }
  .week-pick { width: 100%; }
  .week-pick select { flex: 1; max-width: none; }
}

/* التقارير في الشاشة الضيقة فقط: الورقة تبقى بتنسيق A4 الرسمي مهما كان عرض الجهاز الذي يطبع */
@media screen and (max-width: 900px) {
  .rp-info, .rp-opinions { grid-template-columns: 1fr; }
  .rp-bar { padding-block: 12px; padding-inline: 16px 24px; gap: .75rem; min-height: 72px; border-end-end-radius: 32px; }
  .rp-logo { min-width: 0; }
  .rp-logo img { max-height: 44px; max-width: 90px; }
  .rp-dept { font-size: var(--fs-base); }
  .rp-school { padding: 5px 18px 8px; font-size: var(--fs-sm); max-width: 92%; }
  .rp-titleband { margin: 18px 14px 6px; }
  .rp-titleband h1 { font-size: var(--fs-xl); }
  .rp-body { padding: 14px 14px 20px; }
  .rp-table th, .rp-table td { padding: .4rem .25rem; font-size: var(--fs-xs); }
  .rp-foot-logo { width: 64px; }
  .rp-foot-bar span { font-size: var(--fs-xs); }
}

/* ---------- الطباعة / PDF ---------- */
/* هامش الصفحة صفر حتى يمتد الشريط العلوي والتذييل لحافة الورقة (ويخفي ترويسة المتصفح) */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff; font-size: 11pt; margin: 0; }
  .side, .menu-btn, .head, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  .main, .public-wrap { padding: 0 !important; margin: 0; max-width: none; }
  .report { width: 210mm; min-height: 296mm; max-width: none; margin: 0; box-shadow: none; break-inside: auto; }
  .rp-info { grid-template-columns: repeat(3, 1fr); }
  .rp-opinions { grid-template-columns: 1fr 1fr; }
  .rp-sign { grid-template-columns: repeat(3, 1fr); }
  .rp-table tr { break-inside: avoid; }
  .rp-titleband { margin: 9mm 14mm 2mm; }
  .rp-body { padding: 6mm 14mm 8mm; font-size: 11.5pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
tr.holiday td { background: #fdf6e1; color: var(--muted); }

/* التناوب والتغطية */
.coverage { display: flex; flex-direction: column; gap: .5rem; }
.coverage h3 { margin: 0; }
.bar.big { height: 10px; margin-top: 0; }
.pick .rot { grid-column: 2; font-size: var(--fs-xs); color: var(--muted); }
.pick .rot.new { color: var(--ok); font-weight: 700; }
.pick.suggested { border-color: var(--teal-600); box-shadow: 0 0 0 2px var(--teal-100); }
input.num { width: 5rem; }
.cov-mini { margin-top: .4rem; }

/* ---------- الفلترة والتحديد المتعدد ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: #fafbfb; border: 1px solid var(--line); border-radius: 12px; padding: .6rem; margin-bottom: .9rem; }
.filter-bar input[type=search] { min-width: 200px; }
.filter-bar select { max-width: 220px; }
.f-count { font-size: var(--fs-xs); color: var(--muted); margin-inline-start: auto; white-space: nowrap; }
.side-list .filter-bar { padding: .5rem; }
.side-list .filter-bar input[type=search], .side-list .filter-bar select { width: 100%; max-width: none; min-width: 0; }
.side-list .f-count { margin: 0; }
.d-block { display: block; font-size: var(--fs-xs); }

.bulk-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .75rem; margin-bottom: .75rem; background: var(--teal-50); border: 1px dashed var(--teal-500); border-radius: 10px; }
.bulk-bar [data-sel-count] { font-weight: 700; color: var(--teal-800); min-width: 90px; }
.bulk-bar input[type=datetime-local] { padding: .3rem .5rem; font-size: var(--fs-sm); }
th.chk, td.chk { width: 36px; text-align: center; }
th.chk input, td.chk input { width: 18px; height: 18px; accent-color: var(--teal-600); cursor: pointer; }
tr[data-item]:has(.row-check:checked) td { background: var(--teal-50); }

.stat-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.stat-chip { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .35rem .9rem; display: inline-flex; gap: .4rem; align-items: center; font-size: var(--fs-sm); }
.stat-chip b { font-size: var(--fs-base); }
.stat-chip:hover { border-color: var(--teal-500); }

.mini-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.mini { font-size: var(--fs-xs); padding: .1rem .5rem; border-radius: 6px; background: #fdf0e1; color: var(--warn); white-space: nowrap; }
.mini.done { background: #e5f5ec; color: var(--ok); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.pager [aria-disabled] { opacity: .4; pointer-events: none; }
.week-tabs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.week-tabs a { padding: .25rem .75rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: var(--fs-sm); color: var(--ink); }
.week-tabs a.on { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.tab-btn { font: inherit; font-size: var(--fs-sm); cursor: pointer; padding: .3rem .8rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; }
.tab-btn:hover { border-color: var(--teal-500); }

.card.jump { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .9rem 1.2rem; }
.card.jump label { font-weight: 700; color: var(--teal-900); }
.card.jump input { flex: 1; min-width: 220px; }

/* الاستيراد */
.import-panel { border-top: 4px solid var(--teal-500); }
.steps { margin: 0 0 1rem; padding-inline-start: 1.3rem; display: flex; flex-direction: column; gap: .6rem; }
.steps li { line-height: 1.9; }
.steps form { margin-top: .4rem; }
table.compact th, table.compact td { padding: .4rem .5rem; font-size: var(--fs-sm); }
.cols-table { max-width: 900px; }
.import-report { border-inline-start: 4px solid var(--teal-500); }
.ok-chip { background: #e5f5ec; border-color: #bfe3cf; }
.bad-chip { background: #fbeceb; border-color: #f0c9c5; color: var(--danger); }
.chips span.chip { padding: .3rem .8rem; }

@media print {
  .page-break { page-break-after: always; break-after: page; }
  .page-break:last-child { page-break-after: auto; break-after: auto; }
  body.print-many .report { margin: 0; }
}
@media (max-width: 900px) {
  .filter-bar input[type=search], .filter-bar select { flex: 1 1 100%; max-width: none; }
  .f-count { margin: 0; }
}

/* لوحة التوقيع */
.sig-box { display: flex; flex-direction: column; gap: .9rem; }
.sig-current { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: #fafbfb; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; }
.sig-current img { max-height: 70px; max-width: 220px; background: repeating-conic-gradient(#f2f4f4 0% 25%, #fff 0% 50%) 50% / 14px 14px; border-radius: 6px; }
.sig-form { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.sig-tabs { display: flex; gap: .4rem; }
.tab-btn.on { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.sig-canvas { width: min(520px, 100%); height: 180px; border: 2px dashed var(--teal-500); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }

/* ختم المدرسة فوق توقيع المدير */
.rp-sign div.has-stamp { position: relative; }
.rp-stamp {
  position: absolute; z-index: 2; pointer-events: none;
  width: 108px; height: 108px; object-fit: contain;
  top: 22px; left: 50%; transform: translateX(-130%) rotate(-9deg);
  opacity: .88; mix-blend-mode: multiply;
}
.stamp-preview { max-height: 90px !important; }

/* ---------- التقرير الشامل ---------- */
.an-report { --s-beh: #2a78d6; --s-acad: #eb6834; --q4: #104281; --q3: #2a78d6; --q2: #86b6ef; --q1: #cde2fb; }
.an-filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.an-filters label { display: flex; flex-direction: column; gap: .2rem; font-size: var(--fs-xs); color: var(--muted); }
.an-report { max-width: 1000px; }
.an-body { padding: 18px 34px 28px; }
.an-section { margin-top: 1.6rem; }
.an-section h2 { font-size: var(--fs-lg); color: #173643; border-inline-start: 4px solid #77a17d; padding-inline-start: .6rem; margin-bottom: .8rem; }
.an-section h2 small { font-weight: 400; font-size: var(--fs-xs); }
.an-section h3 { font-size: var(--fs-base); color: #173643; margin-top: 1rem; }
.an-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.an-kpi { border: 1px solid #dde6e2; border-top: 4px solid #173643; border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .15rem; background: #fff; }
.an-kpi span { font-size: var(--fs-xs); color: #4f5f5e; font-weight: 700; }
.an-kpi b { font-size: var(--fs-3xl); line-height: 1.1; color: #173643; font-weight: 800; }
.an-kpi b small { font-size: var(--fs-base); margin-inline-start: 2px; }
.an-kpi em { font-style: normal; font-size: var(--fs-xs); color: var(--muted); display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.lvl { font-size: var(--fs-xs); font-weight: 700; padding: .05rem .5rem; border-radius: 99px; white-space: nowrap; }
.lvl.lv4 { background: #e5f5ec; color: #17633f; }
.lvl.lv3 { background: #e8f1fb; color: #1c5cab; }
.lvl.lv2 { background: #fdf6e1; color: #7a5600; }
.lvl.lv1 { background: #fbeceb; color: #8f2f28; }

.an-obs { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.obs { display: flex; gap: .7rem; align-items: flex-start; border: 1px solid #dde6e2; border-radius: 8px; padding: .65rem .8rem; background: #fff; break-inside: avoid; }
.obs i { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; font-size: var(--fs-xs); color: #fff; }
.obs b { color: #173643; font-size: var(--fs-md); }
.obs p { margin: .15rem 0 0; font-size: var(--fs-sm); color: #3d4c4b; }
.obs-good { border-inline-start: 4px solid #1f8a5b; } .obs-good i { background: #1f8a5b; }
.obs-warn { border-inline-start: 4px solid #b26a00; } .obs-warn i { background: #b26a00; }
.obs-alert { border-inline-start: 4px solid #b4423a; } .obs-alert i { background: #b4423a; }
.obs-info { border-inline-start: 4px solid #2a78d6; } .obs-info i { background: #2a78d6; }
.an-recs { margin: .4rem 0 0; padding-inline-start: 1.3rem; }
.an-recs li { margin-bottom: .35rem; font-size: var(--fs-md); }

.an-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: var(--fs-xs); color: #3d4c4b; margin-bottom: .5rem; }
.an-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sq { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ln { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.q4 { background: var(--q4); color: #fff; } .q3 { background: var(--q3); color: #fff; }
.q2 { background: var(--q2); color: #0d366b; } .q1 { background: var(--q1); color: #0d366b; }
.s-beh { background: var(--s-beh); } .s-acad { background: var(--s-acad); }
.stack-row { display: grid; grid-template-columns: 120px 1fr; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.stack-label { font-size: var(--fs-sm); font-weight: 700; color: #173643; }
.stack { display: flex; height: 30px; gap: 2px; }
.seg { display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; min-width: 3px; cursor: default; }
.seg:first-child { border-radius: 0 4px 4px 0; } .seg:last-child { border-radius: 4px 0 0 4px; }
.an-table { margin-top: .6rem; }
.an-table th { background: #173643; color: #fff; font-size: var(--fs-xs); }
.an-table td { font-size: var(--fs-sm); }
.w-bars { width: 32%; }
.dbar { display: flex; flex-direction: column; gap: 3px; min-width: 140px; }
.dbar-row { display: flex; align-items: center; gap: .4rem; }
.dbar-row i { height: 8px; border-radius: 0 4px 4px 0; display: block; }
.dbar-row b { font-size: var(--fs-xs); font-weight: 500; color: #3d4c4b; white-space: nowrap; }
.mini-bar { display: inline-block; width: 70px; height: 7px; background: #e9eeec; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-inline-end: .3rem; }
.mini-bar i { display: block; height: 100%; background: #173643; }
.an-trend { width: 100%; height: auto; display: block; }
.an-trend .grid { stroke: #e3e9e7; stroke-width: 1; }
.an-trend .axis { fill: #6b7b7a; font-size: 11px; font-family: inherit; }
.an-trend .line { fill: none; stroke-width: 2; }
.an-trend .line.s-beh { stroke: var(--s-beh); background: none; } .an-trend .line.s-acad { stroke: var(--s-acad); background: none; }
.an-trend .pt { stroke: #fff; stroke-width: 2; }
.an-trend .pt.s-beh { fill: var(--s-beh); } .an-trend .pt.s-acad { fill: var(--s-acad); }
.an-trend .hit { fill: transparent; cursor: crosshair; }
.an-trend .hit:hover { fill: rgba(23, 54, 67, .05); }
.an-method { border-top: 1px dashed #dde6e2; padding-top: .6rem; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: #173643; color: #fff; font-size: var(--fs-xs); padding: .35rem .6rem; border-radius: 6px; max-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }

@media (max-width: 900px) {
  .an-kpis { grid-template-columns: 1fr 1fr; }
  .an-obs { grid-template-columns: 1fr; }
  .an-body { padding: 14px; }
  .stack-row { grid-template-columns: 1fr; gap: .2rem; }
  .an-filters label, .an-filters select { width: 100%; }
}
@media print {
  .an-report { min-height: 0 !important; width: auto !important; }
  .an-body { padding: 6mm 12mm 8mm; }
  .an-section { break-inside: auto; }
  .avoid-break, .an-kpis, .obs, .an-table tr { break-inside: avoid; }
  .tip { display: none !important; }
  .an-kpis { grid-template-columns: repeat(3, 1fr); }
  .an-obs { grid-template-columns: 1fr 1fr; }
}
/* التقرير الشامل متعدد الصفحات: هامش للصفحات التالية فقط، والأولى تبقى ممتدة لحافة الورقة */
@page analytics { size: A4; margin: 12mm 0 12mm; }
@page analytics:first { margin-top: 0; }
@media print { .an-report { page: analytics; } }

/* الدخول السريع للتجربة (محلياً فقط) */
.quick-login { margin-top: 1.5rem; border-top: 2px dashed #e0c48a; padding-top: 1rem; }
.quick-login h2 { font-size: var(--fs-base); color: #8a5a00; margin-bottom: .2rem; }
.quick-login h3 { font-size: var(--fs-xs); color: var(--muted); margin: .8rem 0 .35rem; }
.quick-login form { margin: 0 0 .35rem; }
.quick-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .5rem; font: inherit; cursor: pointer;
  background: #fffaf0; border: 1px solid #ecd9ae; border-radius: 10px; padding: .5rem .8rem; text-align: start; }
.quick-btn:hover { background: #fff3da; border-color: #d9b45f; }
.quick-btn span { font-size: var(--fs-xs); color: var(--muted); }
.switch-acc { background: rgba(255,255,255,.15); padding: .1rem .5rem; border-radius: 6px; }

/* ---------- دليل الاستخدام ---------- */
.help-link { display: inline-block; margin-top: .3rem; font-size: var(--fs-xs); background: var(--teal-50); border: 1px solid var(--teal-100); padding: .15rem .7rem; border-radius: 99px; }
.guide h2 { font-size: var(--fs-xl); color: #173643; }
.guide h3 { font-size: var(--fs-base); color: #173643; margin-top: 1rem; }
.guide p { line-height: 1.9; }
.guide-toc { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; position: sticky; top: 0; z-index: 5; }
.guide-toc a { font-size: var(--fs-sm); }
.guide-toc .btn { margin-inline-start: auto; }
.guide-goals { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: .8rem 0; }
.guide-goals div { background: var(--teal-50); border-inline-start: 4px solid #77a17d; border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .2rem; }
.guide-goals b { color: #173643; }
.guide-goals span { font-size: var(--fs-sm); color: #3d4c4b; }
.guide-actors { display: flex; flex-direction: column; gap: .35rem; }
.guide-actors span { font-size: var(--fs-md); } .guide-actors b { color: #173643; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.checklist li { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.checklist li i { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; }
.checklist li.ok i { background: #1f8a5b; color: #fff; } .checklist li.todo i { background: #fdf0e1; color: var(--warn); border: 2px solid #f0c78a; }
.checklist li div { flex: 1; display: flex; flex-direction: column; } .checklist li span { font-size: var(--fs-sm); color: var(--muted); }
.checklist li.ok { background: #fbfefc; }
.cycle { list-style: none; margin: 0; padding: 0; position: relative; }
.cycle li { display: flex; gap: .9rem; padding-bottom: 1rem; position: relative; }
.cycle li:not(:last-child)::before { content: ''; position: absolute; inset-inline-start: 17px; top: 36px; bottom: 0; width: 2px; background: var(--teal-100); }
.cycle-no { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: #173643; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.cycle-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cycle-head b { color: #173643; }
.cycle .who { font-size: var(--fs-xs); background: #fdf0e1; color: #8a5a00; padding: .05rem .55rem; border-radius: 99px; }
.cycle p { margin: .2rem 0 0; font-size: var(--fs-md); color: #3d4c4b; }
.role-box { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; background: #fff; }
.role-box summary { cursor: pointer; padding: .7rem .9rem; font-weight: 700; color: #173643; }
.role-box[open] summary { border-bottom: 1px solid var(--line); background: var(--teal-50); border-radius: 10px 10px 0 0; }
.role-box ol { margin: .6rem 1.6rem .8rem 0; } .role-box li { margin-bottom: .35rem; }
.guide-pages { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.gp { border: 1px solid var(--line); border-top: 4px solid #173643; border-radius: 10px; padding: .8rem 1rem; scroll-margin-top: 70px; }
.gp:target { box-shadow: 0 0 0 3px #77a17d; }
.gp-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.gp-head h3 { margin: 0; }
.gp p { font-size: var(--fs-sm); margin: .4rem 0; } .gp ol { margin: 0 1.3rem 0 0; font-size: var(--fs-sm); } .gp li { margin-bottom: .25rem; }
.gp-tip { background: #fffaf0; border-radius: 6px; padding: .4rem .6rem; font-size: var(--fs-sm) !important; }
.rubric td { vertical-align: top; font-size: var(--fs-sm); line-height: 1.7; }
.faq { border-bottom: 1px solid var(--line); padding: .55rem 0; }
.faq summary { cursor: pointer; font-weight: 700; color: #173643; }
.faq p { margin: .4rem 0 0; font-size: var(--fs-md); color: #3d4c4b; }
.tips { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.tip-card { display: flex; gap: .7rem; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; break-inside: avoid; }
.tip-card > span { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: #77a17d; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.tip-card b { color: #173643; } .tip-card p { margin: .2rem 0 0; font-size: var(--fs-sm); color: #3d4c4b; line-height: 1.8; }
.how-to summary { cursor: pointer; font-weight: 700; color: var(--teal-800); }
.how-to ol { margin: .6rem 1.2rem .6rem 0; }
@media (max-width: 900px) { .guide-goals, .guide-pages, .tips { grid-template-columns: 1fr; } }
@media print { .guide details { display: block; } .guide details > *:not(summary) { display: block !important; } .guide-toc { display: none; } }

/* البنية المدرسية والإسناد المرتبط */
.fs { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem 1rem; margin: 0 0 .8rem; }
.fs legend { font-weight: 800; color: #173643; padding: 0 .4rem; }
.fs h4 { margin: 1rem 0 .2rem; color: #173643; }
.assign-row { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: .6rem; align-items: start; background: var(--teal-50); border: 1px solid var(--teal-100); border-radius: 10px; padding: .6rem .7rem; margin-bottom: .5rem; }
.assign-row label { display: flex; flex-direction: column; gap: .2rem; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.as-secs .lbl { display: block; font-size: var(--fs-xs); color: var(--muted); margin-bottom: .2rem; }
.sec-checks { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; min-height: 38px; }
.sec-chk { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .3rem; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: .25rem .7rem; font-size: var(--fs-sm) !important; color: var(--ink) !important; cursor: pointer; }
.sec-chk:has(input:checked) { background: #173643; color: #fff !important; border-color: #173643; }
.sec-chk input { accent-color: #77a17d; }
.as-line { display: flex; flex-wrap: wrap; gap: .1rem .6rem; }
.as-line span { color: var(--muted); }
.assign-table td { vertical-align: middle; }
.struct-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1.2rem; }
.stage-row { display: grid; grid-template-columns: 1.4fr 1fr auto auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
@media (max-width: 900px) { .assign-row, .struct-grid { grid-template-columns: 1fr; } .stage-row { grid-template-columns: 1fr 1fr auto; } .stage-row small { grid-column: 1 / -1; } }
.username-hint { display: block; margin-top: .25rem; font-size: var(--fs-xs); color: #8a5a00; background: #fffaf0; border: 1px solid #ecd9ae; border-radius: 6px; padding: .2rem .55rem; font-weight: 400; }
.username-hint b { color: #173643; }

/* ---------- طباعة دليل الاستخدام كوثيقة ---------- */
.print-only { display: none; }
.guide-doc { --rp-dark: #173643; --rp-sage: #77a17d; --rp-sage-l: #cadbcc; --rp-sage-m: #b0c6b1; --rp-line: #dde6e2; }
@page guide { size: A4; margin: 12mm 0 14mm; }
@page guide:first { margin-top: 0; }
@media print {
  .guide-doc { page: guide; font-size: 10.5pt; color: #1f2d2c; }
  .print-only { display: block !important; }
  .guide-doc .rp-titleband { margin: 8mm 14mm 6mm; }
  .guide-doc .rp-foot { margin-top: 8mm; }
  .guide .card { border: 0; box-shadow: none; background: none; border-radius: 0; padding: 0 14mm; margin: 0 0 6mm; break-inside: auto; }
  .guide h2 { font-size: 14pt; color: #173643; border-inline-start: 4px solid #77a17d; padding-inline-start: 3mm; margin: 2mm 0 3mm; break-after: avoid; page-break-after: avoid; }
  .guide h2 small, .guide .card > p.muted.small { font-size: 9pt; }
  .guide h3, .guide summary { break-after: avoid; page-break-after: avoid; }
  .guide .btn, .guide .no-print, .help-link, .guide-toc { display: none !important; }
  .guide p { line-height: 1.75; }
  /* عناصر لا تنقسم بين صفحتين */
  .guide-goals div, .guide-actors span, .cycle li, .role-box, .gp, .rubric tr, .faq, .tip-card { break-inside: avoid; page-break-inside: avoid; }
  .guide-goals { grid-template-columns: repeat(3, 1fr); gap: 3mm; }
  .guide-pages, .tips { grid-template-columns: 1fr 1fr; gap: 3mm; }
  .cycle li { padding-bottom: 3mm; }
  .cycle li:not(:last-child)::before { display: none; }
  .cycle-no { width: 7mm; height: 7mm; font-size: 9pt; }
  .role-box { border: 1px solid #dde6e2; border-radius: 6px; margin-bottom: 3mm; }
  .role-box summary { list-style: none; background: #f2f7f4 !important; border-radius: 6px 6px 0 0; padding: 2mm 3mm; }
  .role-box summary::-webkit-details-marker { display: none; }
  .role-box ol { margin: 2mm 6mm 2mm 0; }
  .role-box .badge { display: none; }
  .gp { border: 1px solid #dde6e2; border-top: 3px solid #173643; border-radius: 6px; padding: 3mm 4mm; }
  .gp-tip { background: #f7f4ea !important; }
  .faq { border-bottom: 1px solid #e4ebe8; padding: 2mm 0; }
  .faq summary { list-style: none; } .faq summary::-webkit-details-marker { display: none; }
  .faq summary::before { content: 'س: '; color: #77a17d; }
  .faq p::before { content: 'ج: '; font-weight: 700; color: #173643; }
  .tip-card { border: 1px solid #dde6e2; border-radius: 6px; padding: 3mm; }
  .rubric th { background: #173643 !important; color: #fff !important; }
  .rubric td { font-size: 9.5pt; }
}
@media print {
  .guide details::details-content { content-visibility: visible; display: block; }
  .guide-pages { grid-template-columns: 1fr; }
  .gp ol { columns: 2; column-gap: 6mm; }
  .gp ol li { break-inside: avoid; }
}

/* تقرير الاستيراد: جدول الحسابات والملاحظات المجمّعة */
.ir-accounts { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.ir-accounts h4 { margin: 0; color: #173643; }
.ir-scroll { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.ir-scroll thead th { position: sticky; top: 0; z-index: 1; }
.ir-problems { margin-top: 1rem; }
.ir-problems summary { cursor: pointer; font-weight: 700; color: #173643; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }

/* ---------- الإسناد السريع ---------- */
.assign-list { display: flex; flex-direction: column; gap: .6rem; }
.as-row { display: grid; grid-template-columns: 220px 1fr 150px; gap: .8rem; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; }
.as-row.dirty { border-color: #e0b95f; box-shadow: 0 0 0 2px #fdf0d5; }
.as-who { display: flex; flex-direction: column; gap: .15rem; }
.as-who b { color: #173643; }
.as-summary { color: #3d4c4b; line-height: 1.6; }
.as-blocks { display: flex; flex-direction: column; gap: .5rem; }
.as-block { background: var(--teal-50); border: 1px solid var(--teal-100); border-radius: 10px; padding: .5rem .6rem; }
.as-block-head { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.as-block-head select { flex: 1; max-width: 280px; }
.as-stages { display: flex; flex-direction: column; gap: .3rem; }
.as-stage { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.as-stage-name { width: 4.2rem; font-size: var(--fs-xs); font-weight: 700; color: #173643; }
.as-sec { cursor: pointer; }
.as-sec input { position: absolute; opacity: 0; pointer-events: none; }
.as-sec span { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 1.9rem; padding: 0 .4rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: var(--fs-sm); }
.as-sec input:checked + span { background: #173643; color: #fff; border-color: #173643; font-weight: 700; }
.as-sec input:focus-visible + span { outline: 2px solid #77a17d; }
.as-all { font: inherit; font-size: var(--fs-xs); border: 1px dashed var(--teal-500); background: none; color: var(--teal-700); border-radius: 7px; padding: .2rem .5rem; cursor: pointer; }
.as-actions { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; }
.as-status.ok { color: var(--ok); } .as-status.err { color: var(--danger); }
.assign-help p { margin-bottom: .5rem; }
@media (max-width: 1100px) { .as-row { grid-template-columns: 1fr; } .as-actions { flex-direction: row; flex-wrap: wrap; } }

/* نافذة تقدّم الرفع */
.up-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(23, 54, 67, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.up-overlay[hidden] { display: none; }
.up-card { background: #fff; border-radius: 16px; width: min(460px, 100%); padding: 1.4rem 1.5rem; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.up-icon { width: 54px; height: 54px; margin: 0 auto .6rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--fs-2xl); font-weight: 800; color: #fff; background: #23716b; }
.up-overlay[data-state="work"] .up-icon { background: none; border: 5px solid var(--teal-100); border-top-color: #23716b; animation: upspin .9s linear infinite; }
.up-overlay[data-state="ok"] .up-icon { background: #1f8a5b; }
.up-overlay[data-state="err"] .up-icon { background: #b4423a; }
@keyframes upspin { to { transform: rotate(360deg); } }
.up-title { margin: 0 0 .5rem; color: #173643; }
.up-bar { height: 8px; background: var(--teal-100); border-radius: 99px; overflow: hidden; margin: .4rem 0 .6rem; }
.up-bar i { display: block; height: 100%; width: 0; background: #23716b; transition: width .2s; }
.up-overlay[data-state="ok"] .up-bar, .up-overlay[data-state="err"] .up-bar { display: none; }
.up-msg { color: #3d4c4b; margin: 0 0 .4rem; }
.up-list { text-align: start; margin: .4rem 0; padding-inline-start: 1.2rem; color: #8f2f28; font-size: var(--fs-sm); max-height: 200px; overflow: auto; }
.up-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .8rem; }
.up-card .btn { white-space: normal; }
@media (prefers-reduced-motion: reduce) { .up-overlay[data-state="work"] .up-icon { animation: none; } }
.log-box { background: #0f2129; color: #d6e6e3; font-family: Consolas, monospace; font-size: var(--fs-xs); border-radius: 8px; padding: .6rem .8rem; max-height: 320px; overflow: auto; text-align: left; }
.log-box div { padding: .15rem 0; border-bottom: 1px solid rgba(255,255,255,.06); white-space: pre-wrap; word-break: break-word; }
.replace-opt { background: #fff7e8; border: 1px solid #ecd9ae; border-radius: 8px; padding: .25rem .6rem; }

/* مواد الأسبوع */
.week-subjects .card-head p { margin: .2rem 0 0; }
.ws-subjects { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.ws-chip { cursor: pointer; }
.ws-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ws-chip span { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: var(--fs-sm); }
.ws-chip small { background: var(--teal-100); color: var(--teal-800); border-radius: 99px; padding: 0 .4rem; font-size: var(--fs-xs); }
.ws-chip input:checked + span { background: #173643; color: #fff; border-color: #173643; }
.ws-chip input:checked + span small { background: rgba(255,255,255,.2); color: #fff; }
.ws-chip input:focus-visible + span { outline: 2px solid #77a17d; }
.ws-chip.none span { opacity: .55; }
.up-card { position: relative; }
.up-x { position: absolute; top: .5rem; inset-inline-end: .6rem; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: var(--fs-xl); line-height: 1; cursor: pointer; display: none; }
.up-x:hover { background: var(--teal-50); color: #173643; }
.up-overlay[data-state="ok"] .up-x, .up-overlay[data-state="err"] .up-x { display: block; }

/* ---------- تعدد اللغات ---------- */
.lang-switch { display: flex; flex-wrap: wrap; gap: .3rem; }
.lang-switch a { font-size: var(--fs-xs); padding: .2rem .65rem; border-radius: 99px; text-decoration: none; }
.side-lang { margin-top: -.5rem; }
.side-lang a { color: #fff; border: 1px solid rgba(255,255,255,.3); opacity: .85; }
.side-lang a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.side-lang a.on { background: #fff; color: var(--teal-800); opacity: 1; font-weight: 700; }
.pub-lang { justify-content: flex-end; padding: .6rem 16px 0; max-width: 980px; margin: 0 auto; }
.pub-lang a { color: var(--teal-700); border: 1px solid var(--line); background: #fff; }
.pub-lang a.on { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
[dir="ltr"] body { letter-spacing: 0; }
@media (max-width: 900px) {
  [dir="ltr"] .side { inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: 8px 0 24px rgba(0,0,0,.2); }
  [dir="ltr"] .side.open { transform: none; }
}
@media print { .lang-switch { display: none !important; } }

/* محرر الترجمة */
form.inline { display: inline-flex; margin: 0; }
td.actions { white-space: nowrap; }
td.actions > * { vertical-align: middle; }
.lang-tabs { margin-top: 1rem; }
.lang-filter { margin-bottom: 1rem; }
.lang-filter input[type=search] { min-width: 260px; flex: 1; }
.lang-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.lang-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.lang-row.todo .lang-src { border-inline-start: 3px solid #e0b252; padding-inline-start: .6rem; }
.lang-src { font-size: var(--fs-md); line-height: 1.6; white-space: pre-wrap; text-align: start; }
.lang-src small { display: block; white-space: normal; }
.lang-ref { color: var(--muted); font-size: var(--fs-xs); margin-top: .25rem; text-align: left; }
.lang-dst { display: flex; flex-direction: column; gap: .2rem; }
.lang-dst textarea { width: 100%; resize: vertical; min-height: 2.4rem; font: inherit; font-size: var(--fs-md); }
.lang-dst textarea.dirty { border-color: #e0b252; background: #fffaf0; }
.lang-row.custom .lang-dst textarea:not(.dirty) { border-color: var(--teal-500); }
.lang-save { position: sticky; bottom: 0; background: #fff; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .lang-row { grid-template-columns: 1fr; gap: .4rem; } }
/* نص يكتبه المستخدم: اتجاهه حسب لغته لا لغة الواجهة */
textarea, input[type=text], input[type=search], input:not([type]) { unicode-bidi: plaintext; }
[dir="auto"] { text-align: start; }
/* أدوات رأس الصفحة: اللغة + الأسبوع */
.head-tools { display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.head-lang a { color: var(--teal-700); border: 1px solid var(--line); background: #fff; }
.head-lang a.on { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
@media (max-width: 900px) {
  .head-tools { width: 100%; align-items: stretch; }
  .head-lang { justify-content: flex-end; }
}
/* خيار عدد طلاب الأسبوع */
.weekly-mode { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.weekly-mode legend { font-weight: 700; padding: 0 .4rem; }
.weekly-mode .check { flex-wrap: nowrap; align-items: flex-start; line-height: 1.6; }
.weekly-mode .check > span:first-of-type { flex: 1; min-width: 0; }
.weekly-mode .check input[type=radio] { margin-top: .35rem; flex-shrink: 0; }
.weekly-mode .check:has(.num) { align-items: center; }
.weekly-mode .check:has(.num) > span:first-of-type { flex: 0 1 auto; }
.weekly-mode .num { width: 90px; }
/* إرسال واتساب بالتتابع */
.ok-text { color: #1f8a5b; }
.sent-state { margin-top: .25rem; }
.wa-queue .up-card { text-align: center; }
.wq-current { font-size: var(--fs-lg); margin: .4rem 0; }
.wq-phone { color: var(--muted); font-size: var(--fs-sm); }
.wq-actions { flex-wrap: wrap; justify-content: center; }
.wq-mode { margin-top: .8rem; color: var(--muted); }
.wq-mode select { font-size: var(--fs-sm); padding: .2rem .4rem; }
.wq-phone { unicode-bidi: isolate; display: inline-block; }
.wa-mode-pick { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.wa-mode-pick select { font-size: var(--fs-xs); padding: .2rem .4rem; }
/* الإرسال الآلي عبر واتساب */
.wa-st { font-size: var(--fs-xs); }
.wa-st-sent { color: #5b6b6a; }
.wa-st-del { color: #1f8a5b; }
.wa-st-read { color: #2a78d6; }
.wa-st-fail { color: #b4423a; }
.wa-guide { margin: .6rem 0; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: var(--teal-50); }
.wa-guide summary { cursor: pointer; }
.wa-guide .steps li { line-height: 1.7; }
.wa-tpl { margin-top: .8rem; }
.wa-tpl h4 { font-size: var(--fs-md); margin-bottom: .4rem; }
.wa-tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.wa-tpl pre { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; font-family: inherit; font-size: var(--fs-sm); margin: .3rem 0; }
.wa-test { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--line); flex-wrap: wrap; gap: .5rem; align-items: center; }
.wa-test input { width: 160px; }
.wa-fails { text-align: start; }
@media (max-width: 760px) { .wa-tpl-grid { grid-template-columns: 1fr; } }
/* ربط الموجهين */
.cc-form { gap: .6rem; }
.cc-stage { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .45rem; }
.cc-secs { display: flex; flex-wrap: wrap; gap: .35rem; }
tr.other-scope td { opacity: .62; }
/* السجل الشامل للطالب */
.rc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: .8rem 0 1rem; }
.rc-kpi { border: 1px solid var(--rp-line, #dde6e2); border-top: 4px solid #173643; border-radius: 8px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .2rem; background: #fff; }
.rc-kpi span { font-size: var(--fs-xs); color: #5b6b6a; }
.rc-kpi b { font-size: var(--fs-base); align-self: flex-start; }
.rc-kpi small { color: #5b6b6a; }
.rc-trend { padding: .15rem .6rem; border-radius: 99px; }
.rc-up { background: #e6f4ec; color: #1f8a5b; } .rc-down { background: #fbeceb; color: #b4423a; } .rc-flat { background: #eef2f1; color: #3d4c4b; }
.rc-section { margin: 1rem 0; }
.rc-section h4 { color: #173643; border-inline-start: 4px solid #77a17d; padding-inline-start: .5rem; margin-bottom: .5rem; }
.rc-chart { width: 100%; max-width: 680px; height: auto; display: block; margin: 0 auto; }
.rc-chart .rc-grid { stroke: #e3e9e7; stroke-width: 1; }
.rc-chart .rc-axis { font-size: 11px; fill: #5b6b6a; font-family: inherit; }
.rc-chart polyline { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.rc-chart polyline.rc-beh, .rc-chart circle.rc-beh { stroke: #173643; } .rc-chart circle.rc-beh { fill: #173643; }
.rc-chart polyline.rc-acad, .rc-chart circle.rc-acad { stroke: #77a17d; } .rc-chart circle.rc-acad { fill: #77a17d; }
.rc-legend { text-align: center; font-size: var(--fs-xs); color: #5b6b6a; }
.rc-key { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-inline: .4rem .2rem; }
.rc-key.rc-beh { background: #173643; } .rc-key.rc-acad { background: #77a17d; }
.rc-matrix td { vertical-align: top; }
.rc-cell { display: flex; align-items: center; gap: .3rem; margin: .1rem 0; white-space: nowrap; }
.rc-cell small { color: #5b6b6a; font-size: var(--fs-xs); min-width: 2.6rem; }
.rc-notes dt { font-weight: 700; color: #173643; margin-top: .5rem; }
.rc-notes dd { margin: .15rem 0; padding-inline-start: .8rem; font-size: var(--fs-sm); }
.rc-op { border: 1px solid #e3e9e7; border-radius: 8px; padding: .5rem .8rem; margin-bottom: .5rem; }
.rc-op p { margin: .25rem 0; font-size: var(--fs-sm); }
.link-box { min-width: 240px; flex: 1; }
.d-block { display: block; }
@media (max-width: 760px) { .rc-kpis { grid-template-columns: 1fr; } }
@media print { .rc-section { break-inside: avoid; } .rc-matrix { font-size: 9pt; } }
/* زر العين لكلمة المرور */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-inline-end: 2.6rem; }
.pw-eye { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: .45rem; background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: .25rem; line-height: 0; border-radius: 6px; }
.pw-eye:hover { color: var(--teal-700); background: var(--teal-50); }
/* نسيت كلمة المرور */
.forgot { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .8rem; }
.forgot summary { cursor: pointer; color: var(--teal-700); font-size: var(--fs-sm); }
.forgot form { margin-top: .7rem; }
.pw-requests { border-inline-start: 4px solid #b26a00; }

/* ===== مسابقة الفصل المثالي ===== */
.cc-page { background: linear-gradient(180deg, #e9f2ee, #f6f9f8 40%); }
.cc-wrap { max-width: 520px; margin: 0 auto; padding: 14px 14px 40px; }
.cc-head { display: flex; align-items: center; gap: .8rem; margin: .4rem 0 1rem; }
.cc-trophy { font-size: var(--fs-4xl); }
.cc-head h1 { font-size: var(--fs-xl); color: #173643; font-weight: 800; }
.cc-head p { color: var(--muted); font-size: var(--fs-sm); }
.cc-card { background: #fff; border-radius: 16px; padding: 1.1rem; box-shadow: 0 6px 24px rgba(23,54,67,.08); margin-bottom: 1rem; }
.cc-card h2 { font-size: var(--fs-lg); color: #173643; margin-bottom: .4rem; }
.cc-center { text-align: center; }
.cc-class-tag { display: inline-block; background: #173643; color: #fff; border-radius: 99px; padding: .3rem 1rem; font-weight: 800; font-size: var(--fs-lg); margin-bottom: .6rem; }
.cc-who { display: flex; justify-content: space-between; align-items: center; color: #173643; font-weight: 700; margin-bottom: .6rem; }
.cc-link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: var(--fs-sm); }
.cc-big { width: 100%; padding: .9rem; font-size: var(--fs-lg); border-radius: 12px; margin-top: .6rem; }
.cc-nid { font-size: var(--fs-xl); letter-spacing: .25em; text-align: center; }
.cc-label { display: block; font-weight: 700; color: #173643; margin: .6rem 0 .35rem; }
.cc-periods { display: flex; flex-wrap: wrap; gap: .45rem; }
.cc-p { width: 2.7rem; height: 2.7rem; border-radius: 12px; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--fs-lg); color: #173643; text-decoration: none; background: #fff; }
.cc-p.rated { background: #e6f4ec; border-color: #9cc9ad; }
.cc-p.on { background: #173643; border-color: #173643; color: #fff; }
.cc-p.off { opacity: .35; pointer-events: none; }
.cc-legend-rated::before { content: ''; display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; background: #e6f4ec; border: 1px solid #9cc9ad; vertical-align: middle; margin-inline-end: .3rem; }
.cc-crit { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.cc-crit-name { font-weight: 800; color: #173643; font-size: var(--fs-base); }
.cc-crit-val { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin-top: .1rem; }
.cc-crit-val.ok { color: #17633f; } .cc-crit-val.warn { color: #a3392f; }
.cc-guide { background: var(--teal-50); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; margin: .6rem 0; }
.cc-guide summary { cursor: pointer; font-weight: 700; color: var(--teal-800); }
.cc-guide-t { width: 100%; margin: .5rem 0; border-collapse: collapse; }
.cc-guide-t td { padding: .25rem .3rem; border-bottom: 1px dashed var(--line); }
.cc-guide-c { margin: .3rem 0; padding-inline-start: 1.1rem; }
.cc-tv-code { font-size: var(--fs-4xl); text-align: center; letter-spacing: .3em; font-weight: 800; max-width: 320px; margin: .5rem auto; display: block; }
.cc-group-link { border: 1px solid var(--line); background: var(--teal-50); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .8rem; }
.cc-group-link .link-box { flex: 1; min-width: 220px; }
.cc-total { text-align: center; font-weight: 800; font-size: var(--fs-lg); padding: .6rem; border-radius: 10px; margin: .7rem 0; background: #eef1f1; }
.cc-total.pos { background: #e5f5ec; color: #17633f; } .cc-total.neg { background: #fbeceb; color: #8f2f28; }
/* النجوم: الترتيب المعكوس + ~ يلوّن النجمة المختارة وما قبلها */
.cc-stars { display: inline-flex; flex-direction: row-reverse; gap: .1rem; }
[dir="rtl"] .cc-stars { flex-direction: row-reverse; }
.cc-stars input { position: absolute; opacity: 0; pointer-events: none; }
.cc-stars label { font-size: var(--fs-4xl); line-height: 1; color: #d6dfdc; cursor: pointer; padding: 0 .08rem; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; transition: transform .1s, color .1s; -webkit-tap-highlight-color: transparent; }
.cc-stars label:active { transform: scale(1.2); }
.cc-stars input:checked ~ label { color: #e8a91c; }
@media (hover: hover) { .cc-stars label:hover, .cc-stars label:hover ~ label { color: #f1c75a; } }
.cc-note { margin-top: .6rem; }
.cc-note summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); }
.cc-note textarea { width: 100%; margin-top: .4rem; }
.cc-done { text-align: center; border: 2px solid #9cc9ad; }
.cc-check { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: #1f8a5b; color: #fff; font-size: var(--fs-3xl); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .4rem; }
.cc-install { display: flex; gap: .7rem; align-items: flex-start; margin-top: 1rem; padding: .8rem; border-radius: 12px; background: var(--teal-50); border: 1px solid var(--teal-100); }
.cc-install-ic img { border-radius: 10px; display: block; }
.cc-install-body { flex: 1; }
.cc-install-body p { margin: .2rem 0 .5rem; }
.cc-install-ios { margin: .3rem 0 0; padding-inline-start: 1.1rem; line-height: 1.8; }
.cc-ios-share { display: inline-block; border: 1px solid #9bb; border-radius: 5px; padding: 0 .3rem; color: #1a73e8; font-weight: 700; }
.cc-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin: .4rem 0 .8rem; background: #e7eeec; padding: .3rem; border-radius: 14px; }
.cc-tabs a { text-align: center; padding: .65rem .4rem; border-radius: 11px; font-weight: 800; color: #173643; text-decoration: none; }
.cc-tabs a.on { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); color: var(--teal-800); }
.bh-search { width: 100%; margin-bottom: .5rem; }
.bh-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; max-height: 300px; overflow-y: auto; padding: .2rem; }
.bh-st, .bh-item, .bh-lv { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bh-st input, .bh-item input, .bh-lv input { position: absolute; opacity: 0; pointer-events: none; }
.bh-st span { display: block; padding: .55rem .6rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 700; font-size: var(--fs-md); }
.bh-st input:checked + span { border-color: var(--teal-600); background: var(--teal-50); color: var(--teal-800); }
.bh-st input:checked + span::before { content: '✓ '; }
.bh-items { display: flex; flex-wrap: wrap; gap: .4rem; }
.bh-group { width: 100%; font-size: var(--fs-xs); font-weight: 800; margin-top: .4rem; color: var(--muted); }
.bh-item span { display: inline-block; padding: .5rem .8rem; border-radius: 99px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: var(--fs-sm); }
.bh-item.pos input:checked + span { background: #e5f5ec; border-color: #1f8a5b; color: #17633f; }
.bh-item.neg input:checked + span { background: #fbeceb; border-color: #c0453a; color: #8f2f28; }
.bh-levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.bh-lv span { display: block; text-align: center; padding: .55rem .2rem; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: var(--fs-sm); }
.bh-lv input:checked + span { background: #173643; border-color: #173643; color: #fff; }
.bh-today-h { font-size: var(--fs-base); margin: 1rem 0 .4rem; }
.bh-today { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.bh-today li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .7rem; border-radius: 10px; font-size: var(--fs-sm); }
.bh-today li.pos { background: #f2f9f5; } .bh-today li.neg { background: #fdf3f2; }
.tc-stage { margin: .9rem 0; }
.tc-stage-h { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; font-size: var(--fs-base); color: #173643; padding-bottom: .35rem; border-bottom: 2px solid var(--teal-100); }
.tc-stage-h small { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.cc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .5rem; }
.cc-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 78px; border-radius: 14px; border: 2px solid var(--line); background: #fff; text-decoration: none; color: #173643; -webkit-tap-highlight-color: transparent; }
.cc-tile:active { transform: scale(.96); }
.cc-tile-n { font-size: var(--fs-2xl); font-weight: 800; line-height: 1; }
.cc-tile small { font-size: var(--fs-xs); font-weight: 700; color: #b26a00; }
.cc-tile.done { border-color: #9cc9ad; background: #f2f9f5; }
.cc-tile.done small { color: #1f8a5b; }
.cc-tile.other { border-style: dashed; }
.cc-tile.other small { color: var(--muted); }
.cc-others { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.cc-others summary { cursor: pointer; font-weight: 800; color: var(--teal-800); padding: .3rem 0; }
.cc-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: .8rem 0; }
.cc-class { display: flex; flex-direction: column; gap: .2rem; padding: .8rem; border-radius: 12px; border: 2px solid var(--line); text-decoration: none; color: #173643; background: #fff; }
.cc-class small { color: #b26a00; font-weight: 700; }
.cc-class.done { border-color: #9cc9ad; background: #f2f9f5; }
.cc-class.done small { color: #1f8a5b; }
/* لوحة الإدارة */
.cc-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 1rem; }
.cc-board > .card { min-width: 0; }
.cc-board .table-wrap { margin: 0 -.25rem; }
tr.cc-lead td { background: #fff8e6; }
.cc-stars-s { color: #e8a91c; letter-spacing: -1px; white-space: nowrap; }
.cc-stars-s span { color: #d6dfdc; }
.cc-tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; align-items: end; }
.cc-tm-days { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 700px) { .cc-tm-days { grid-template-columns: repeat(3, 1fr); } }
.cc-break { border: 1px solid var(--line); border-radius: 10px; padding: .7rem; margin-bottom: .6rem; background: var(--teal-50); }
.cc-break [data-remove-break] { justify-self: start; }
.cc-break summary { cursor: pointer; margin-top: .5rem; font-weight: 600; }
.cc-stage-row { display: flex; flex-wrap: wrap; gap: .3rem 1rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.cc-tm-table td { white-space: nowrap; }
.cc-tm-gapline { font-size: var(--fs-xs); color: #7a5300; margin-top: .15rem; }
.cc-tm-gapline.pr { color: #17633f; }
/* رموز QR للطباعة */
.cc-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.cc-theme { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .6rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; text-align: center; }
.cc-theme:has(input:checked) { border-color: var(--teal-600); background: var(--teal-50); }
.cc-theme input { position: absolute; opacity: 0; pointer-events: none; }
.cc-theme .sw { width: 100%; height: 46px; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); }
.cc-print-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: .8rem; margin-top: .5rem; }
.cc-print-opts > div { border: 1px solid var(--line); border-radius: 10px; padding: .7rem; background: var(--teal-50); }
.cc-print-opts .btn { margin-top: .4rem; }
.cc-qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.cc-qr-card { border: 2px dashed #9cb3ad; border-radius: 14px; padding: 1rem; text-align: center; background: #fff; break-inside: avoid; }
.cc-qr-title { font-weight: 800; color: #173643; font-size: var(--fs-md); }
.cc-qr { width: 170px; height: 170px; margin: .6rem auto; }
.cc-qr svg { width: 100%; height: 100%; }
.cc-qr-class { font-size: var(--fs-xl); font-weight: 900; color: #173643; }
.cc-qr-hint { color: var(--muted); font-size: var(--fs-sm); }
@media print { .cc-qr-grid { grid-template-columns: repeat(3, 1fr); } .shell .side, .head, .tabs { display: none !important; } }
/* الشهادة */
.cc-cert { margin: 1rem auto; max-width: 900px; aspect-ratio: 1.414; background: #fff; border: 10px solid #173643; outline: 3px solid #77a17d; outline-offset: -22px; padding: 4%; display: flex; }
.cc-cert-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem; }
.cc-cert-logo { max-height: 70px; }
.cc-cert-school { color: var(--muted); font-weight: 700; }
.cc-cert h1 { font-size: var(--fs-4xl); color: #173643; font-weight: 900; }
.cc-cert-text { font-size: var(--fs-lg); max-width: 80%; line-height: 1.9; }
.cc-cert-class { font-size: var(--fs-4xl); font-weight: 900; color: #b08a3e; border-bottom: 3px solid #e8b84a; padding: 0 2rem .3rem; }
.cc-cert-sign { margin-top: 1rem; }
.cc-cert-sign div { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.cc-cert-sign img { max-height: 60px; }
.cc-cert-sign i { display: block; width: 180px; height: 50px; border-bottom: 1px dotted #999; }
@media print { body:has(.cc-cert) * { visibility: hidden; } body:has(.cc-cert) .cc-cert, body:has(.cc-cert) .cc-cert * { visibility: visible; } .cc-cert { position: fixed; inset: 0; margin: 0; max-width: none; } }
.nowrap { white-space: nowrap; }
/* سلوك الطلاب */
.bh-filters select { min-width: 150px; }
.op-notes textarea { width: 100%; min-width: 220px; font-size: var(--fs-sm); }
.op-orig { margin-top: .2rem; }
.op-evals > summary { cursor: pointer; font-weight: 700; }
.bh-mine { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.bh-mine summary { cursor: pointer; font-weight: 800; color: var(--teal-800); padding: .3rem 0; }
.bh-mine .bh-today { max-height: 360px; overflow-y: auto; margin-top: .4rem; }
.bh-comp-tag { display: inline-block; font-size: var(--fs-xs); font-weight: 700; color: #17633f; background: #e5f5ec; border-radius: 6px; padding: 0 .4rem; }
.bh-comp { margin-top: .35rem; padding: .35rem .55rem; border-radius: 8px; background: #e5f5ec; color: #17633f; font-size: var(--fs-sm); font-weight: 700; }
.bh-comp-f { display: inline-block; vertical-align: top; }
.bh-comp-f summary { list-style: none; cursor: pointer; }
.bh-comp-f summary::-webkit-details-marker { display: none; }
.bh-comp-f[open] { display: block; margin: .3rem 0; }
.bh-comp-f textarea { width: 100%; min-width: 220px; margin: .3rem 0; }
.bh-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin: .6rem 0; }
.bh-kpis div { background: var(--teal-50); border: 1px solid var(--line); border-radius: 12px; padding: .7rem; text-align: center; }
.bh-kpis b { display: block; font-size: var(--fs-2xl); font-weight: 800; }
.bh-kpis span { font-size: var(--fs-sm); color: var(--muted); }
.bh-kpis .pos b { color: #17633f; } .bh-kpis .neg b { color: #a3392f; }
.bh-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-inline-end: .35rem; }
.bh-dot.pos { background: #1f8a5b; } .bh-dot.neg { background: #c0453a; }
tr.bh-weak td:first-child { box-shadow: inset -4px 0 0 #c0453a; }
.bh-items-t input:not([type=checkbox]), .bh-items-t select { width: 100%; min-width: 0; }
.bh-items-t td:nth-child(2) { min-width: 240px; }
tr.bh-new td { background: var(--teal-50); }
.bh-items-t td:nth-child(1) select { min-width: 110px; }
.bh-items-t td:nth-child(3) select { min-width: 64px; }
/* اختيار السلوك على الجوال */
.bh-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; background: #e7eeec; padding: .3rem; border-radius: 12px; margin-bottom: .5rem; }
.bh-kinds button { border: 0; background: transparent; padding: .6rem .3rem; border-radius: 9px; font: inherit; font-weight: 800; color: #173643; cursor: pointer; }
.bh-kinds button.on { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.bh-degs { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: .4rem; -webkit-overflow-scrolling: touch; }
.bh-degs button { flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: .35rem .8rem; font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; }
.bh-degs button.on { background: #8f2f28; border-color: #8f2f28; color: #fff; }
.bh-ilist { display: flex; flex-direction: column; gap: .35rem; max-height: 340px; overflow-y: auto; padding: .15rem; }
.bh-irow { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .65rem .8rem; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bh-irow input { position: absolute; opacity: 0; pointer-events: none; }
.bh-irow .t { font-weight: 700; font-size: var(--fs-md); line-height: 1.4; }
.bh-irow .d { flex: 0 0 auto; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.bh-irow.pos .d b { color: #17633f; } .bh-irow.neg .d b { color: #a3392f; }
.bh-irow.pos:has(input:checked) { border-color: #1f8a5b; background: #e5f5ec; }
.bh-irow.neg:has(input:checked) { border-color: #c0453a; background: #fbeceb; }
.bh-irow:has(input:checked) .t::before { content: '✓ '; }
.bh-none { text-align: center; padding: .6rem; }
.bh-chosen { margin-top: .5rem; padding: .55rem .8rem; border-radius: 10px; font-weight: 800; font-size: var(--fs-md); }
.bh-chosen.pos { background: #e5f5ec; color: #17633f; } .bh-chosen.neg { background: #fbeceb; color: #8f2f28; }
.bh-students { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* ---------- الجداول المتجاوبة: بطاقة لكل صف على الجوال ---------- */
@media screen and (max-width: 640px) {
  table.rtable thead { display: none; }
  table.rtable, table.rtable tbody, table.rtable tr, table.rtable td { display: block; width: 100%; }
  table.rtable tr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .35rem .75rem; margin-bottom: .6rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
  table.rtable tr[hidden] { display: none; }
  table.rtable td { border: 0; border-bottom: 1px dashed var(--line); padding: .45rem 0; display: flow-root; text-align: start; white-space: normal; }
  table.rtable td:last-child { border-bottom: 0; }
  table.rtable td::before { content: attr(data-label); float: right; width: 34%; margin-inline-end: 4%; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); line-height: 1.45; }
  [dir="ltr"] table.rtable td::before { float: left; }
  table.rtable td[data-label=""]::before { display: none; }
  /* الخلية الأولى عنوان البطاقة */
  table.rtable td:first-child:not(.chk) { font-size: var(--fs-base); }
  table.rtable td:first-child:not(.chk)::before { float: none; display: block; width: auto; margin-bottom: .1rem; }
  table.rtable td.chk { padding: .3rem 0; border-bottom: 0; min-height: 0; }
  table.rtable td.actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
  table.rtable td:has(> .btn), table.rtable td:has(> form) { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
  table.rtable td.actions::before { float: none; width: 100%; }
  table.rtable td:has(> .btn)::before, table.rtable td:has(> form)::before { float: none; width: 100%; }
  table.rtable td.nowrap { white-space: normal; }
  table.rtable input:not([type=checkbox]):not([type=radio]), table.rtable select, table.rtable textarea { width: 100%; max-width: 100%; }
  .table-wrap:not(.ir-scroll):has(table.rtable) { overflow: visible; }
  .table-wrap.ir-scroll { overflow-y: auto; }
  table.rtable td { overflow-wrap: anywhere; }
}

/* عمودا التخطيط المقسوم يتقلّصان مع المحتوى بدل أن يتمددا خارج الشاشة */
.split > * { min-width: 0; }
@media screen and (max-width: 1100px) {
  /* جداول التقرير الشامل التي لا تتحول لبطاقات: تمرير أفقي داخلها بدل قصّها */
  .an-report .an-table:not(.rtable) { display: block; overflow-x: auto; }
}
@media screen and (max-width: 640px) {
  /* الأزرار ذات النص الطويل تلتف على سطرين بدل أن تخرج عن الشاشة */
  .main .btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.35; }
}

/* ---------- مراجعة التصميم (توافق الشاشات والمتصفحات) ---------- */
@media screen and (max-width: 480px) { .rp-sign { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .side { height: auto; } }
.check[hidden], .sec-chk[hidden] { display: none !important; }
@media print {
  /* الصفحات العادية (غير التقارير) تُطبع بهامش حتى لا تقصّها الطابعة */
  body:not(:has(.report)):not(:has(.cc-cert)) .main { padding: 10mm !important; }
  .table-wrap { overflow: visible !important; }
  .rc-cell { white-space: normal; }
}

/* سلوك الطلاب: أزرار الترتيب ووسوم السلوك المجمّعة */
.bh-sorts { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .7rem; }
.bh-sorts a { padding: .4rem .9rem; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: var(--fs-sm); color: var(--ink); text-decoration: none; }
.bh-sorts a.on { color: #fff; border-color: var(--teal-700); background: var(--teal-700); }
.bh-sorts a.on.neg { background: #a3392f; border-color: #a3392f; }
.bh-sorts a.on.pos { background: #1f8a5b; border-color: #1f8a5b; }
.op-also, .op-mine { margin: .6rem 0; }
.op-also > summary, .op-mine > summary { cursor: pointer; font-weight: 700; }
.op-also-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: .2rem .8rem; max-height: 22rem; overflow-y: auto; margin-top: .5rem; }
.op-also-list .check { align-items: flex-start; }
.op-mine ul { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .4rem; }
.op-mine li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .7rem; }
.op-mine li > span { min-width: 0; overflow-wrap: anywhere; }
.bh-send { scroll-margin-top: 90px; }
.bh-msg { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow-y: auto; margin: .5rem 0 .8rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--teal-50); color: var(--ink); }
.bh-contacts { margin: .3rem 0 0; padding: 0; list-style: none; }
.bh-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: .7rem; margin-top: .7rem; }
.bh-way { min-width: 0; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; }
.bh-send .bh-way h4 { margin-top: 0; }
.bh-contacts li { margin: .35rem 0; overflow-wrap: anywhere; }
.bh-contacts form.inline { display: inline-block; }
.bh-public .bh-msg { max-height: none; }
.bh-public .bh-msg strong { font-weight: 800; }
.bh-send h4 { margin: 1rem 0 .3rem; }
.bh-parent > * { display: block; margin: .15rem 0; }
.bh-parent > .btn { display: inline-flex; }
body:not(.ui) .bh-send .ok-text, body:not(.ui) .bh-parent .ok-text { color: #17633f; }
body:not(.ui) .bh-send .warn { color: #8f2f28; }
body:not(.ui) .bh-send .btn.wa, body:not(.ui) .bh-parent .btn.wa { background: #0f7a43; color: #fff; }
.bh-tag { display: inline-block; margin: .1rem 0; padding: .1rem .5rem; border-radius: 6px; font-size: var(--fs-xs); }
.bh-tag.pos { background: #e5f5ec; color: #17633f; } .bh-tag.neg { background: #fbeceb; color: #8f2f28; }

.bh-multi { position: relative; display: inline-block; }
.bh-multi summary { list-style: none; cursor: pointer; }
.bh-multi summary::-webkit-details-marker { display: none; }
.bh-multi-box { position: absolute; z-index: 20; inset-inline-end: 0; top: calc(100% + .3rem); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: .7rem .8rem; min-width: 260px; max-width: min(92vw, 420px); max-height: 60vh; overflow-y: auto; }
.bh-multi-st { display: flex; flex-wrap: wrap; gap: .25rem .9rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.bh-multi-st > label:first-child { width: 100%; }
.bh-multi-box [data-mapply] { margin-top: .6rem; width: 100%; }
@media (max-width: 640px) { .bh-multi { display: block; width: 100%; } .bh-multi-box { position: static; max-width: none; margin-top: .4rem; } }

/* فرص التعويض في ملف الطالب */
.bh-compcard h4 { margin: 1rem 0 .5rem; font-size: var(--fs-base); }
.bh-comp-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 2fr; gap: .6rem; align-items: stretch; margin: .6rem 0; }
.bh-comp-sum > div { background: var(--teal-50); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .7rem; text-align: center; }
.bh-comp-sum span { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.bh-comp-sum b { font-size: var(--fs-xl); font-weight: 800; }
.bh-comp-bar { position: relative; display: flex; flex-direction: column; justify-content: center; }
.bh-comp-bar i { display: block; height: 12px; border-radius: 99px; background: #1f8a5b; min-width: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.bh-comp-bar::before { content: ''; position: absolute; inset-inline: .7rem; top: 50%; height: 12px; margin-top: -14px; border-radius: 99px; background: #e2e8e7; z-index: 0; }
.bh-comp-bar i, .bh-comp-bar small { position: relative; z-index: 1; }
.bh-comp-bar small { margin-top: .35rem; font-weight: 700; color: #17633f; }
.bh-comp-list { display: flex; flex-direction: column; gap: .6rem; }
.bh-comp-item { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: .8rem; align-items: start; }
.bh-comp-item:target { border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-100); }
.bh-comp-what { display: flex; flex-direction: column; gap: .2rem; }
.bh-comp-ded { align-self: flex-start; font-size: var(--fs-xs); font-weight: 700; color: #8f2f28; background: #fbeceb; border-radius: 6px; padding: .05rem .5rem; }
.bh-comp-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; align-items: end; }
.bh-comp-form label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: .2rem; }
.bh-comp-form select, .bh-comp-form input { width: 100%; min-width: 0; }
.bh-comp-done { margin-top: .8rem; }
.bh-comp-done summary { cursor: pointer; font-weight: 700; color: var(--teal-800); }
.bh-comp-done ul { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-direction: column; gap: .4rem; }
.bh-comp-done li { display: flex; justify-content: space-between; gap: .6rem; align-items: center; background: #f2f9f5; border-radius: 10px; padding: .5rem .7rem; }
@media (max-width: 1250px) { .bh-comp-item { grid-template-columns: 1fr; } .bh-comp-form { grid-template-columns: 1fr 1fr auto; } }
@media (max-width: 700px) { .bh-comp-form { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .bh-comp-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); } .bh-comp-bar { grid-column: 1 / -1; } }

/* ---------- بوابة المبادرات ---------- */
.side nav .nav-back { font-size: var(--fs-sm); opacity: .85; }
.nav-ini { display: flex; align-items: center; gap: .55rem; margin: .3rem 0 .4rem; padding: .6rem .7rem; border-radius: 12px; background: rgba(255,255,255,.12); border-inline-start: 4px solid var(--ini); }
.nav-ini span { font-size: var(--fs-xl); line-height: 1; }
.nav-ini b { font-size: var(--fs-md); line-height: 1.35; }
.nav-sep { margin: .8rem .3rem .2rem; font-size: var(--fs-xs); font-weight: 700; opacity: .65; letter-spacing: .2px; }
.portal-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: linear-gradient(135deg, var(--teal-700), var(--teal-900)); color: #fff; border-radius: 18px; padding: 1.3rem 1.5rem; margin-bottom: 1.2rem; }
.portal-hero h2 { font-size: var(--fs-xl); margin: 0 0 .2rem; }
.portal-hero p { margin: 0; opacity: .85; }
.portal-date { background: rgba(255,255,255,.14); border-radius: 99px; padding: .35rem .9rem; font-weight: 700; font-size: var(--fs-sm); }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 1.1rem; }
.portal-card { position: relative; display: flex; flex-direction: column; gap: .7rem; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 1.3rem 1.3rem 1.1rem; color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.portal-card::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 6px; background: var(--ini); }
.portal-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,.08); text-decoration: none; }
.portal-top { display: flex; align-items: center; gap: .8rem; }
.portal-ic { width: 58px; height: 58px; flex: 0 0 58px; display: grid; place-items: center; font-size: var(--fs-2xl); border-radius: 16px; background: color-mix(in srgb, var(--ini) 14%, #fff); }
.portal-top h3 { margin: 0; font-size: var(--fs-lg); line-height: 1.4; }
.portal-card p { margin: 0; color: var(--muted); font-size: var(--fs-md); line-height: 1.7; }
.portal-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem; }
.portal-stats div { background: var(--teal-50); border-radius: 10px; padding: .5rem; text-align: center; }
.portal-stats b { display: block; font-size: var(--fs-lg); font-weight: 800; color: var(--ini); }
.portal-stats span { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.portal-go { margin-top: auto; align-self: flex-start; font-weight: 800; color: var(--ini); }

/* ---------- لوحة الشرف ---------- */
.hon-av { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #ece6fa; color: #4b2f94; border: 3px solid #fff; box-shadow: 0 0 0 2px #d9cdf5; }
.hon-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hon-av i { font-style: normal; font-weight: 800; font-size: var(--fs-base); }
.hon-av.xl { width: 150px; height: 150px; flex-basis: 150px; }
.hon-av.xl i { font-size: var(--fs-4xl); }
.hon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: .8rem; }
.hon-card { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem; background: #fff; }
.hon-info { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: .1rem; }
.hon-info b { font-size: var(--fs-base); }
.hon-reason { font-size: var(--fs-sm); font-weight: 700; color: #5a3aa8; }
.hon-act { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin: 0; }
.hon-act input[name=reason] { width: 190px; padding: .3rem .55rem; font-size: var(--fs-sm); }
.hon-sub { margin: 1rem 0 .6rem; font-size: var(--fs-md); display: flex; flex-direction: column; gap: .15rem; }
.hon-sub small { font-weight: 400; }
.hon-add summary { cursor: pointer; padding: .2rem 0; }
.hon-add[open] summary { margin-bottom: 1rem; }
.hon-hidden { margin-top: 1rem; }
.hon-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.hon-chips form { margin: 0; }
.hon-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; margin-top: 1rem; }
.hon-ph { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; padding: .8rem .4rem; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; }
.hon-ph:hover { text-decoration: none; border-color: #c9b8f0; background: #faf8ff; }
.hon-ph .hon-av { width: 72px; height: 72px; flex-basis: 72px; }
.hon-ph b { font-size: var(--fs-sm); line-height: 1.4; }
.hon-photo-form { display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; }
.hon-photo-box { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.hon-photo-preview { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.hon-photo-preview small { font-weight: 700; color: #5a3aa8; }
.hon-file { cursor: pointer; }
@media (max-width: 600px) { .hon-act input[name=reason] { width: 100%; } .hon-act { width: 100%; } }
.hon-student .form.grid2 { grid-template-columns: 1fr; }

/* ---------- سجل عملياتي ---------- */
.act-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.act-stat { color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.act-stat:hover { text-decoration: none; transform: translateY(-2px); }
.act-stat span { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.act-stat.on { border-color: var(--teal-500); box-shadow: 0 0 0 2px var(--teal-100); }
.act-stars { color: #d99a1e; white-space: nowrap; letter-spacing: 1px; }
.act-stars .muted { color: #dfe5e4; }
#act-list b.pos { color: #17633f; } #act-list b.neg { color: #a3392f; }

/* ---------- الزيارات الصفية ---------- */
.vs-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vs-stats .stat span { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.vs-head .card-head h3 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.vs-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: .7rem; }
.vs-info div { background: #f4f8fd; border-radius: 12px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .15rem; }
.vs-info span { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.vs-note { margin: .8rem 0 0; background: #fffaf0; border-radius: 10px; padding: .55rem .8rem; }
.vs-action { margin-top: 1rem; border: 1px dashed #b9cdea; background: #f7faff; border-radius: 14px; padding: .8rem 1rem; }
.vs-action p { margin: 0 0 .6rem; }
.vs-alt { margin-top: .8rem; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
.vs-head > .row { margin-top: .8rem; }
.vs-crit { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.vs-crow { display: flex; justify-content: space-between; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; padding: .55rem .8rem; }
.vs-crow > span { font-weight: 700; }
.vs-levels { display: flex; gap: .3rem; flex-wrap: wrap; }
.vs-lv input { position: absolute; opacity: 0; pointer-events: none; }
.vs-lv span { display: inline-block; padding: .3rem .75rem; border-radius: 99px; border: 1px solid var(--line); font-size: var(--fs-sm); cursor: pointer; background: #fff; }
.vs-lv input:focus-visible + span { outline: 2px solid var(--teal-500); }
.vs-lv.l4 input:checked + span { background: #1f8a5b; border-color: #1f8a5b; color: #fff; }
.vs-lv.l3 input:checked + span { background: #2563a8; border-color: #2563a8; color: #fff; }
.vs-lv.l2 input:checked + span { background: #c98a12; border-color: #c98a12; color: #fff; }
.vs-lv.l1 input:checked + span { background: #b4533d; border-color: #b4533d; color: #fff; }
.vs-lv.l0 input:checked + span { background: #eef1f1; color: var(--muted); }
.vs-pill { display: inline-block; padding: .2rem .8rem; border-radius: 99px; font-weight: 700; font-size: var(--fs-sm); }
.vs-pill.l4 { background: #e5f5ec; color: #17633f; } .vs-pill.l3 { background: #e6eefa; color: #1d4f8a; }
.vs-pill.l2 { background: #fdf3df; color: #8a5a06; } .vs-pill.l1 { background: #fbeceb; color: #8f2f28; }
.vs-table { width: 100%; margin-bottom: 1rem; }
.vs-plan > .form { margin-bottom: .9rem; }
.vs-plist { display: flex; flex-direction: column; gap: .7rem; }
.vs-prow { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: .7rem .9rem; }
.vs-prow.is-off .vs-pgrid { opacity: .6; }
.vs-prow.is-off .vs-pgrid input, .vs-prow.is-off .vs-pgrid select { pointer-events: none; }
.vs-pon { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; min-height: 44px; cursor: pointer; }
.vs-pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: .6rem; }
.vs-pgrid label { display: flex; flex-direction: column; gap: .25rem; min-width: 0; font-size: var(--fs-sm); font-weight: 500; }
.vs-pgrid select, .vs-pgrid input { width: 100%; min-width: 0; }
.vs-block { border-inline-start: 4px solid #2563a8; background: #f7faff; border-radius: 10px; padding: .6rem .9rem; margin-bottom: .7rem; }
.vs-block h4 { margin: 0 0 .3rem; font-size: var(--fs-md); }
.vs-block p { margin: 0; line-height: 1.8; }
.vs-ack { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.vs-print-title, .print-only { display: none; }
.vs-guests { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; display: grid; gap: .6rem; min-width: 0; }
.vs-guests legend { font-weight: 700; padding: 0 .3rem; }
.vs-guest-q { width: 100%; }
.vs-guest-group .row { justify-content: space-between; }
.vs-guest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .15rem .8rem; max-height: 16rem; overflow-y: auto; }
.vs-guest-list .check { align-items: flex-start; }
.vs-otable th, .vs-otable td { text-align: center; }
.vs-otable td.rp-subj { text-align: start; }
.vs-otable .vs-pill { display: inline-grid; place-items: center; min-width: 2rem; }
@media print { .vs-print { display: block !important; } .vs-print .report { margin: 0; } }
/* صفحة طباعة تقرير الزيارة: عرض ثابت في كل الأجهزة */
body.vs-print-page { background: #e9eef1; }
body.vs-print-page .public-wrap { max-width: 230mm; margin: 0 auto; padding: 16px 0 40px; }
body.vs-print-page .report { width: 210mm; max-width: none; margin: 0 auto; }
@media print { body.vs-print-page { background: #fff; } body.vs-print-page .public-wrap { padding: 0; max-width: none; } }
.vs-sign { grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2rem; }
.vs-sign div { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.vs-sign img { max-height: 60px; } .vs-sign i { display: block; width: 70%; border-bottom: 1px solid #333; height: 50px; }
@media print {
  .vs-print-title { display: block; font-size: 16pt; font-weight: 800; text-align: center; margin-bottom: 10pt; }
  .print-only { display: block; } .vs-sign.print-only { display: grid; }
  .vs-head, .vs-report { box-shadow: none; border: 0; padding: 0; }
  .vs-info div, .vs-block { background: #fff; border: 1px solid #ccc; }
  .vs-stats, .filter-bar { display: none !important; }
}

/* تقييم الأداء الوظيفي */
.pf-rate td { vertical-align: middle; }
.pf-group td { background: #eef4f2; font-weight: 800; color: #173643; }
.pf-levels { display: flex; gap: .3rem; flex-wrap: wrap; }
.pf-lv input { position: absolute; opacity: 0; pointer-events: none; }
.pf-lv span { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 800; cursor: pointer; background: #fff; }
.pf-lv input:checked + span { background: #173643; border-color: #173643; color: #fff; }
.pf-lv.l5 input:checked + span { background: #15573a; border-color: #15573a; }
.pf-lv.l1 input:checked + span { background: #93271f; border-color: #93271f; }
.pf-lv input:focus-visible + span { outline: 3px solid var(--teal-500); outline-offset: 2px; }
.pf-lv.l0 span { padding: 0 .65rem; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.pf-lv.l0 input:checked + span { background: #eef1f1; border-color: #9aa8a6; color: #36504f; }
.vs-formname { margin: 0 0 .8rem; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.vs-prev { margin: .4rem 0 1rem; }
.vs-prev label { display: grid; gap: .3rem; max-width: 280px; margin-top: .5rem; font-weight: 700; }
.vs-prev-st { margin: .3rem 0 0; }
.pf-live { font-size: var(--fs-base); }
.pf-preview { overflow-x: auto; margin-top: .6rem; }
.pf-preview .report { margin: 0 auto; }
.pf-table th, .pf-table td { text-align: center; }
.pf-table td.rp-subj { text-align: start; }
.pf-table tfoot td { font-weight: 800; background: #f4f8f5; }
.pf-table .pf-level { color: #173643; }
.pf-tick { font-weight: 800; color: #15573a; }
.pf-scale, .pf-note { font-size: var(--fs-xs); color: #4f5f5e; margin: .4rem 0; }
/* الطباعة: النموذج كله في ورقة A4 واحدة (التنسيق نفسه من الجوال والحاسب) */
@media print {
  .pf-official { min-height: 0 !important; }
  .pf-official .rp-bar { min-height: 0; padding-block: 3mm; }
  .pf-official .rp-logo img { max-height: 13mm; }
  .pf-official .rp-titleband { margin: 3mm 12mm 1mm; padding-block: 2mm; }
  .pf-official .rp-titleband h1 { font-size: 15pt; }
  .pf-official .rp-titleband span { font-size: 8.5pt; }
  .pf-official .rp-body { padding: 2mm 12mm 3mm; font-size: 9pt; }
  .pf-official .rp-info { margin: 0 0 2mm; gap: 1.5mm; }
  .pf-official .rp-info div { padding: 1mm 2.5mm; }
  .pf-official .rp-info dt { font-size: 7pt; }
  .pf-official .rp-info dd { font-size: 9pt; line-height: 1.3; }
  .pf-official .pf-table th, .pf-official .pf-table td { padding: .45mm 1mm; font-size: 7.8pt; line-height: 1.2; }
  .pf-official .pf-table th { padding-block: .8mm; }
  .pf-official .pf-scale, .pf-official .pf-note { font-size: 7pt; margin: .8mm 0; }
  .pf-official .rp-opinions { gap: 1.5mm; margin-top: 1.5mm; }
  .pf-official .rp-opinion { padding: 1mm 2.5mm; border-top-width: 2px; }
  .pf-official .rp-opinion h4 { font-size: 8.5pt; margin: 0 0 .5mm; }
  .pf-official .rp-opinion p { font-size: 8pt; line-height: 1.3; }
  .pf-official .rp-closing { font-size: 8pt; margin: 1.5mm 0 0; }
  .pf-official .rp-sign { margin-top: 2mm; }
  .pf-official .rp-sig, .pf-official .rp-sig img { height: 12mm; max-height: 12mm; }
  .pf-official .rp-sign b { min-height: 0; padding-top: .8mm; font-size: 8.5pt; }
  .pf-official .rp-sign span { font-size: 8pt; }
  .pf-official .rp-foot { min-height: 9mm; margin-top: 2mm; }
}

/* حقول التاريخ: إخفاء تلميحة كروم المقلوبة ما دام الحقل فارغاً، وتلميحة صحيحة تحته */
input[type=date].dt-empty:not(:focus)::-webkit-datetime-edit { color: transparent; }
.dt-hint { display: block; margin-top: .25rem; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.dt-hint[hidden] { display: none; }
/* زر الحفظ أثناء الإرسال */
.is-busy { pointer-events: none; cursor: progress; opacity: .8; }
.is-busy::before { content: ''; display: inline-block; width: .9em; height: .9em; margin-inline-end: .45em; vertical-align: -.12em;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: busy-spin .7s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-busy::before { animation-duration: 2s; } }
@media print { .dt-hint { display: none !important; } }

/* تقييماتي: اختيار الأسبوع لا يتجاوز عرض البطاقة في الجوال */
.my-week-pick { align-items: flex-end; }
.my-week-pick label { flex: 1 1 260px; min-width: 0; }
.my-week-pick select { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; }

/* ==================== مراجعة التصميم 2026-11-28 ==================== */
/* سلّم الحركة المشترك */
:root { --dur: .18s; --ease: cubic-bezier(.2, .7, .2, 1); }

/* التصميم «الحالي»: تباين AA للنصوص الخافتة والحالات (body.ui له قيمه في base.css) */
:root { --muted: #5b6b69; --warn: #8a5300; --ok: #17663f; --wa: #12803f; }
body:not(.ui) .badge { color: #4f5f5d; }
body:not(.ui) .choice.g2 input:checked + span { background: #8a6500; border-color: #8a6500; }
body:not(.ui) input, body:not(.ui) select, body:not(.ui) textarea { border-color: #a9b7b5; }
body:not(.ui) input:focus-visible, body:not(.ui) select:focus-visible, body:not(.ui) textarea:focus-visible,
body:not(.ui) input:focus, body:not(.ui) select:focus, body:not(.ui) textarea:focus { outline: 3px solid var(--teal-500); outline-offset: 1px; border-color: var(--teal-700); }
body:not(.ui) a:focus-visible, body:not(.ui) button:focus-visible, body:not(.ui) .btn:focus-visible { outline: 3px solid var(--teal-500); outline-offset: 2px; }
.btn.wa:hover { background: #0e6a34; }

/* النجوم الفارغة: حد أدنى 3:1 */
.cc-stars label { color: #8a9b99; }

/* أزرار: انتقال وحالة ضغط */
.btn { transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
details > summary { transition: background-color var(--dur) var(--ease); }

/* تأكيد الحفظ: رسالة النجاح تظهر بحركة لطيفة */
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash { animation: flash-in .35s var(--ease) both; }
.flash.success { box-shadow: 0 0 0 3px rgba(31, 138, 91, .12); }

/* خلايا الإجراءات تبقى خلية جدول فلا تنكسر خطوط الصفوف */
table td.actions { display: table-cell; vertical-align: middle; }
table td.actions > :not([hidden]) { margin: 3px; vertical-align: middle; }
table td.actions > form:not([hidden]) { display: inline-block; }

/* ألوان خارج اللوحة */
.ws-chip input:checked + span { background: var(--teal-800); border-color: var(--teal-800); }

/* القائمة الجانبية في «الحالي» على الجوال: مخفية عن Tab وهي مغلقة، خلفية معتمة، وزر إغلاق */
.side-close, .side-backdrop { display: none; }
@media (max-width: 900px) {
  body:not(.ui) .side { box-shadow: none; visibility: hidden; transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur); }
  body:not(.ui) .side.open { visibility: visible; box-shadow: -8px 0 24px rgba(0, 0, 0, .2); transition: transform var(--dur) var(--ease); }
  body:not(.ui) .side-close { display: inline-flex; align-self: flex-start; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .9rem;
    background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }
  body:not(.ui) .side-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(16, 40, 38, .45); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease); }
  body:not(.ui) .side.open ~ .side-backdrop, body:not(.ui).menu-open .side-backdrop { opacity: 1; pointer-events: auto; }
  body:not(.ui) .menu-btn { width: 44px; height: 44px; }
  /* أهداف لمس 44px */
  body:not(.ui) .btn { min-height: 44px; }
  body:not(.ui) .btn.sm { min-height: 40px; padding: .45rem .9rem; }
  body:not(.ui) .side nav a { min-height: 44px; }
  body:not(.ui) .me a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: .4rem; }
  body:not(.ui) .lang-switch a { display: inline-flex; align-items: center; min-height: 40px; }
  /* رأس أقصر */
  body:not(.ui) .head { margin-bottom: .8rem; gap: .5rem; }
  body:not(.ui) .head h2 { font-size: var(--fs-xl); line-height: 1.35; }
  body:not(.ui) .head p { font-size: var(--fs-sm); margin-top: .15rem; }
  body:not(.ui) .head-tools { width: 100%; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
  body:not(.ui) .head-lang { order: 2; }
  body:not(.ui) .help-link { font-size: var(--fs-sm); }
}
@media (prefers-reduced-motion: reduce) {
  .side, .side-backdrop, .btn, .flash, details > summary { transition: none !important; animation: none !important; }
}

/* التقارير الرسمية: نص التذييل داكن واضح، وعناوين البيانات بتباين AA */
.rp-foot-bar span { color: var(--rp-dark); text-shadow: none; font-weight: 700; }
.rp-info dt { color: #56655f; }

/* تقريرا الزيارة والأداء: التذييل أسفل الورقة، وخط مقروء (9pt) */
@media print {
  .pf-official { min-height: 296mm !important; }
  .pf-official .rp-body { font-size: 9pt; }
  .pf-official .rp-info dt { font-size: 7.6pt; }
  .pf-official .rp-info dd { font-size: 9pt; }
  .pf-official .pf-table th, .pf-official .pf-table td { font-size: 8.4pt; }
  .pf-official .pf-scale, .pf-official .pf-note { font-size: 7.8pt; }
  .pf-official .rp-opinion h4 { font-size: 9pt; }
  .pf-official .rp-opinion p { font-size: 8.8pt; line-height: 1.35; }
  .pf-official .rp-closing { font-size: 8.6pt; }
  .pf-official .rp-sign span, .pf-official .rp-sign b { font-size: 8.8pt; }
  .pf-official .rp-foot { margin-top: auto; }
}

/* ==================== بقية مراجعة التصميم 2026-11-28 ==================== */
/* أيقونات بدل الرموز التعبيرية */
.emo-ic { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; display: inline-block; }
.emo-ic.emo-ok { color: var(--ok); } .emo-ic.emo-bad { color: var(--danger); }
.side nav small .emo-ic, .badge .emo-ic { width: 1em; height: 1em; }
/* «المزيد» في التصميم الحالي */
.row-more { position: relative; display: inline-block; }
.row-more > summary { list-style: none; cursor: pointer; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more > summary::after { content: '▾'; font-size: .8em; margin-inline-start: .3rem; }
.row-more-in { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 8; min-width: 170px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 40, 38, .14); padding: .45rem; display: flex; flex-direction: column; gap: .35rem; }
.row-more-in > *, .row-more-in form .btn { width: 100%; justify-content: flex-start; }
.row-more-in form { margin: 0; }
@media (max-width: 640px) { .row-more-in { position: static; box-shadow: none; margin-top: .35rem; } }
/* ترتيب الفصول: المعادلة رقائق واضحة الاتجاه، والجدول مضغوط في الجوال */
.cc-formula { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem; margin-bottom: .8rem; }
.cc-rule { display: inline-block; padding: .1rem .55rem; border-radius: 99px; background: var(--teal-50); border: 1px solid var(--line); color: var(--ink); font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) {
  body .cc-board table.cc-rank th, body .cc-board table.cc-rank td { padding: .35rem .12rem; font-size: var(--fs-xs); white-space: nowrap; }
  body .cc-board table.cc-rank th:first-child, body .cc-board table.cc-rank td:first-child { width: 1.6rem; }
  .cc-board > .card { padding-inline: .7rem; }
  .cc-board .table-wrap { margin: 0; }
  body .cc-board table.cc-rank th:nth-child(4), body .cc-board table.cc-rank td:nth-child(4) { display: none; }
}

/* ==================== سلّم مقاسات الخط (2026-11-28) ==================== */
/* كل مقاسات الشاشة من هذه الدرجات فقط. لا نص أصغر من 12.5px. مقاسات الطباعة (pt) خارج السلّم عمداً. */
:root {
  --fs-xs: .78rem;   /* 12.5px: الشارات والتلميحات */
  --fs-sm: .875rem;  /* 14px: النص الثانوي والجداول */
  --fs-md: .9375rem; /* 15px: نص الصفحة */
  --fs-base: 1rem;   /* 16px: الخانات والعناوين الصغيرة */
  --fs-lg: 1.15rem;  /* 18.4px: عناوين البطاقات */
  --fs-xl: 1.4rem;   /* 22.4px: عناوين الأقسام */
  --fs-2xl: 1.75rem; /* 28px: عنوان الصفحة */
  --fs-3xl: 2rem;    /* 32px: الأرقام الكبيرة */
  --fs-4xl: 2.4rem;  /* 38.4px: أرقام العرض والنجوم */
}

/* ==================== تقرير السلوك الشامل (2026-11-28) ==================== */
.bh-rtypes { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.bh-rtypes legend { font-weight: 700; padding: 0 .3rem; }
.bh-rdates { gap: .5rem 1rem; }
.bh-official .bh-rtable th, .bh-official .bh-rtable td { font-size: var(--fs-sm); }
.bh-official .bh-rtable td small { color: #56655f; }
@page bhrep { size: A4; margin: 12mm 0 12mm; }
@page bhrep:first { margin-top: 0; }
@media print {
  .bh-official { page: bhrep; min-height: 0 !important; }
  .bh-official .rp-body { font-size: 9.5pt; }
  .bh-official .bh-rtable th, .bh-official .bh-rtable td { font-size: 8.8pt; padding: 1.2mm 1.2mm; line-height: 1.3; }
  .bh-official .bh-rtable thead { display: table-header-group; }
  .bh-official .bh-rtable tr { break-inside: avoid; }
  .bh-official .rp-sign, .bh-official .rp-opinions { break-inside: avoid; }
}

/* كل التقارير الرسمية: شريط العنوان مضغوط لا ينافس الترويسة (عدا دليل الاستخدام) */
.report:not(.guide-doc) .rp-titleband { margin: 14px 38px 4px; padding: 7px 16px 6px; box-shadow: 0 5px 0 -3px var(--rp-sage-l); }
.report:not(.guide-doc) .rp-titleband h1 { font-size: var(--fs-lg); }
.report:not(.guide-doc) .rp-titleband span { font-size: var(--fs-xs); margin-top: .1rem; }
@media print {
  .report:not(.guide-doc) .rp-titleband { margin: 3mm 12mm 1mm; padding: 1.8mm 4mm 1.5mm; }
  .report:not(.guide-doc) .rp-titleband h1 { font-size: 12.5pt; }
  .report:not(.guide-doc) .rp-titleband span { font-size: 8pt; }
}
@media screen and (max-width: 900px) { .report:not(.guide-doc) .rp-titleband { margin: 12px 14px 4px; } }

/* ==================== إفادة ولي الأمر (2026-11-28) ==================== */
.ack-panel { max-width: 820px; margin: 1rem auto; border-top: 4px solid var(--teal-500); }
.ack-panel h3 { margin: 0 0 .35rem; color: var(--teal-900); }
.ack-panel.done { border-top-color: var(--ok); background: #f3faf6; }
.ack-state { margin-top: .25rem; }
.ack-note { margin: .25rem 0 0; color: var(--ink); }
.ack-req { white-space: nowrap; }
.ack-stats .stat { color: inherit; text-decoration: none; }
.ack-stats .stat.on { outline: 2px solid var(--teal-500); }
.ack-flow { margin: 0 0 .6rem; }

/* ==================== غياب الطلاب (2026-11-29) ==================== */
.ab-st input:checked + span { background: #fbeceb; border-color: #c9574a; color: #8f2f28; font-weight: 700; }
.ab-when { display: block; font-size: var(--fs-xs); font-weight: 400; color: #8f2f28; }
.ab-filters form { gap: .5rem .75rem; }
.ab-quick { margin-inline-start: auto; }
.ab-pickbar { justify-content: flex-end; margin-bottom: .5rem; }
.ab-grid th, .ab-grid td { text-align: center; }
.ab-grid td.rp-subj { text-align: start; }
.ab-x { color: #8f2f28; }
.stat.ab-stat-when { min-width: 0; }
.stat.ab-stat-when b.small { font-size: 1rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }

/* تذكير المعلمين المتأخرين */
.ln-late { background: #fdf0e3; color: #9a5a12; }
.rm-card .rm-actions { flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.rm-card .rm-edit { margin-top: .8rem; }
.rm-card .rm-edit textarea { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.7; }
.rm-state { color: #9a5a12; }

/* استمارة زيارة صفية: الكتابة */
.vs-cform .vs-cgrp { border: 1px solid var(--line); border-radius: 12px; padding: .4rem .9rem .7rem; margin: .7rem 0; min-width: 0; }
.vs-cform .vs-cgrp legend { font-weight: 800; padding: 0 .4rem; }
.vs-citem { padding: .6rem 0; border-top: 1px dashed var(--line); }
.vs-citem:first-of-type { border-top: 0; }
.vs-citem p { margin: 0 0 .4rem; line-height: 1.6; }
.vs-cnote-in { width: 100%; box-sizing: border-box; margin-top: .45rem; }
/* استمارة زيارة صفية: التقرير الرسمي */
.vs-ctable th.vs-cgroup { width: 15%; background: #eef5f1; color: #173643; font-size: .9em; vertical-align: middle; }
.vs-ctable td.vs-clevel { width: 14%; text-align: center; white-space: nowrap; }
.vs-ctable td.vs-clevel small { color: #4f5f5e; }
.vs-ctable td.vs-cnote { width: 24%; font-size: .9em; }
.vs-crec .vs-clines { min-height: 3.2em; border-bottom: 1px dotted #9aa; }
.vs-cinfo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .vs-cinfo { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media print {
  .vs-class-form .rp-info { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .vs-class-form .vs-ctable th, .vs-class-form .vs-ctable td { padding: .5mm 1.2mm; font-size: 7.6pt; line-height: 1.25; }
  .vs-class-form .vs-ctable th.vs-cgroup { font-size: 7.6pt; }
  .vs-class-form .rp-opinion { margin-top: 1.5mm; }
}
.vs-pfilter { border: 1px solid var(--line); border-radius: 12px; padding: .4rem .9rem .8rem; margin: 0; min-width: 0; }
.vs-pfilter legend { font-weight: 800; padding: 0 .4rem; }
.vs-pfilter > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem 1rem; }
.vs-pfilter label { min-width: 0; }
.vs-rep .vs-rrec { font-size: .9em; min-width: 22%; }
.vs-rep + .vs-rep { margin-top: 1.2rem; }
@media print { .vs-rep + .vs-rep { break-before: page; page-break-before: always; margin-top: 0; } }

/* استئذان المعلمين */
.lv-kinds { display: flex; flex-wrap: wrap; gap: .6rem; }
.lv-kind { flex: 1 1 160px; display: flex; align-items: center; gap: .5rem; border: 1.5px solid var(--line); border-radius: 12px; padding: .7rem .9rem; cursor: pointer; font-weight: 700; }
.lv-kind:has(input:checked) { border-color: var(--brand, #23716b); background: #eef6f4; }
.lv-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.lv-times[hidden] { display: none; }
.lv-item { border: 1px solid var(--line); border-inline-start: 4px solid #c9a23a; border-radius: 12px; padding: .7rem .9rem; margin: .7rem 0; }
.lv-item.lv-approved { border-inline-start-color: #2e8b57; }
.lv-item.lv-rejected { border-inline-start-color: #b3443c; }
.lv-item.lv-cancelled { border-inline-start-color: #9aa; opacity: .75; }
.lv-item.lv-info { border-inline-start-color: #2563a8; }
.lv-item p { margin: .3rem 0; }
.lv-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.lv-note { background: #f4f8f5; border-radius: 8px; padding: .4rem .6rem; }
.lv-reply { background: #eef3fa; border-radius: 8px; padding: .4rem .6rem; }
.lv-decide { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.lv-decide input[name=note] { width: 100%; box-sizing: border-box; }
.lv-link { width: min(100%, 26rem); box-sizing: border-box; }
.lv-qrbox { width: min(260px, 70vw); }
.lv-today ul { margin: .3rem 0 0; padding-inline-start: 1.2rem; }
@media print { .lv-qr[open] summary { font-size: 14pt; } }
