/* ══════════════════════════════════════════════════════════════════════
   نقاط اللجان — ملفّ الأنماط الوحيد.

   يُخدَم ثابتًا من public بلا أي بناء أصول: لا Vite ولا npm، فالسيرفر لا
   يحتاج Node إطلاقًا. وكسر الذاكرة المؤقّتة بـ ?v=filemtime في القالب.

   منقول من التصميم المعتمد في design3/_vocab.css: الرموز دلالية بأسماء
   معنى، والمفردات مغلقة، والقوالب تستدعي الأصناف باسمها لا صفوف utility.
   ══════════════════════════════════════════════════════════════════════ */

/* الرموز دلالية بأسماء معنى: القالب لا يعرف قيمة لون واحدة */
:root {
  --paper: #f4f1ea;      /* ورق مكسور البياض، لا رماديّ أزرق */
  --surface: #ffffff;
  --surface-2: #faf7f1;  /* خلفية أهدأ للصفّ غير المسجَّل */
  --ink: #171410;        /* أغمق نصّ يميل للبنيّ، لا أسود نقيّ */
  --ink-2: #584f48;
  --ink-3: #776e67;      /* أُغمق من التخطيط الأول: 4.42:1 على الورق، و10.5px يحتاج ذلك */
  --line: #e1dcd4;
  --line-2: #cbc5ba;
  /* اللكنة الافتراضية: نيليّ. تُبدَّل من data-accent على <html> بسطر واحد،
     وكل البدائل مفحوصة التباين (الأدنى 8.7:1). */
  --accent: #25306c;
  --accent-dark: #171e52;
  --accent-soft: #e2e7f7;
  --ok: #256b3a;
  --danger: #9e2c2c;
  --warn: #9a6a17;
}

[data-accent='pine']   { --accent: #074a33; --accent-dark: #003722; --accent-soft: #e5f5ec; }
[data-accent='indigo'] { --accent: #25306c; --accent-dark: #171e52; --accent-soft: #e2e7f7; }
[data-accent='wine']   { --accent: #681525; --accent-dark: #4f0316; --accent-soft: #f7e3e4; }
[data-accent='petrol'] { --accent: #004459; --accent-dark: #003143; --accent-soft: #dbebf2; }
[data-accent='clay']   { --accent: #5b2d17; --accent-dark: #451d08; --accent-soft: #f7e4dc; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ── الهيكل: عمود واحد، شريط علويّ + محتوى + تنقّل سفليّ ── */
.screen {
  inline-size: 100%; max-inline-size: 560px; margin-inline: auto;
  min-block-size: 100dvh; display: flex; flex-direction: column;
  background: var(--paper);
}
.topbar {
  background: var(--accent); color: #fff;
  padding: 14px 18px 13px;
  padding-block-start: max(14px, env(safe-area-inset-top));
}
.topbar .eyebrow { color: rgba(255, 255, 255, .72); }
.topbar h1 { margin: 3px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.body { flex: 1 1 auto; padding: 0 18px; overflow: hidden; }
.tabs {
  position: sticky; inset-block-end: 0; z-index: 3; display: flex;
  background: var(--surface); border-block-start: 1px solid var(--line);
  padding-block-end: max(0px, env(safe-area-inset-bottom));
}
.tab {
  flex: 1 1 0; min-block-size: 54px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-3); font-size: 10.5px; font-weight: 500;
}
.tab[aria-current='page'] { color: var(--accent); }

/* ── مفردات ── */
.eyebrow { font-size: 10.5px; font-weight: 500; letter-spacing: .1em; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;   /* الفصل بالحدود لا بالظلال */
}
.list { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-block-end: 1px solid var(--line); }
.row:last-child { border-block-end: 0; }
.row.quiet { background: var(--surface-2); }   /* الحالة مقروءة بلا لمس */
.item { flex: 1 1 auto; min-inline-size: 0; }
.item .name { font-size: 13.5px; font-weight: 500; line-height: 1.5; }
.item .meta { font-size: 10.5px; color: var(--ink-3); line-height: 1.6; }

.seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg button, .seg a {
  flex: 1 1 0; min-block-size: 34px; padding-inline: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 9px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  text-decoration: none;
}
.seg button[aria-pressed='true'],
.seg a[aria-current='true'] { background: var(--accent); color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-block-size: 34px; padding-inline: 12px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.chip[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  block-size: 24px; padding-inline: 8px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 10.5px; font-weight: 500; color: var(--ink-2);
}
.badge.ok { color: var(--ok); }
.badge.wait { color: var(--ink-3); }

.label { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-2); margin-block-end: 6px; }
.field {
  inline-size: 100%; min-block-size: 50px; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 13px;
  font: inherit; font-size: 13px; line-height: 1.85; color: var(--ink);
}
.field.compact { min-block-size: 42px; padding-block: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-block-size: 50px; padding-inline: 18px; border-radius: 13px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { min-block-size: 40px; border-radius: 11px; font-size: 12.5px; padding-inline: 14px; }
.btn.state { min-block-size: 42px; border-radius: 11px; }
.btn[disabled], .btn.is-off { opacity: .45; cursor: default; }   /* معطَّل من البيانات لا بالتخمين */
.btn.quietdanger { border: 0; background: none; color: var(--danger); font-weight: 500; }

.sheet { border-radius: 22px 22px 0 0; background: var(--surface); border: 1px solid var(--line); }
.modal { border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
/* الظلّ مقصور على ما يطفو فعلاً */
.sheet, .modal { box-shadow: 0 -2px 24px rgba(23, 20, 16, .14); }
.modal { box-shadow: 0 8px 32px rgba(23, 20, 16, .18); }

.cal { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.cal button {
  min-block-size: 42px; border-radius: 9px; background: var(--surface);
  border: 1px solid var(--line); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cal button[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }

.track { block-size: 4px; background: var(--line); border-radius: 7px; display: flex; overflow: hidden; }
.track > i { background: var(--accent); }

.hr { block-size: 1px; background: var(--line); border: 0; margin: 0; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ══════════════════════════════════════════════════════════════════════
   أصناف أُضيفت بعد التصميم، كلٌّ منها تكرّر ثالثة في القوالب قبل أن يُسمّى.
   ══════════════════════════════════════════════════════════════════════ */

/* زرّ فوق الشريط العلويّ: شفّاف على اللكنة لا أبيض عليها */
.btn.onaccent {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .24);
  color: #fff;
}

/* شريط على سقف لجنته، والعلامة الرأسية متوسط الصف في تلك اللجنة وحدها.
   الغلاف أطول من الشريط لأن العلامة تبرز فوقه وتحته. */
.scale { position: relative; block-size: 15px; margin-block-start: 9px; }
.scale > .track { position: absolute; inset-inline: 0; inset-block-start: 4px; }
.scale > .avg { position: absolute; inset-block-start: 0; inline-size: 2px; block-size: 15px; background: var(--ink-2); }

/* الطبقة الخافتة تحت الورقة والنافذة: بلا blur، بلون الحبر شفّافًا */
.overlay { position: fixed; inset: 0; background: rgba(23, 20, 16, .38); border: 0; }

/* الورقة السفلية تُثبَّت بأسفل المنفذ ولا تتجاوز عرض العمود */
.sheet-wrap {
  position: fixed; inset-block-end: 0; inset-inline: 0;
  inline-size: 100%; max-inline-size: 560px; margin-inline: auto;
  z-index: 2;
}

/* صفّ التقارير: الاسم يتمدّد والأرقام أعمدة ثابتة العرض حتى تتحاذى رأسيًا */
/* ‏min-inline-size صريح: لولاه لتمدّدت الخلية إلى مقاس أطول كلمة فيها،
   فاتّسع رأس «المبادرات» عن خانة رقمه وانحرف العمودان عن بعضهما. */
.cell {
  flex: 0 0 56px; min-inline-size: 56px;
  text-align: center; font-variant-numeric: tabular-nums; font-size: 13px;
  overflow-wrap: anywhere;
}
.cell.total { font-size: 13.5px; font-weight: 600; color: var(--accent); }

/* الرسم البياني: محسوب في الخادم، والحاوية تمنع تمدّده خارج البطاقة */
.chart { display: block; inline-size: 100%; }
.chart-axis {
  display: flex; justify-content: space-between;
  padding-inline: 2px; font-size: 9.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* رسالة الفراغ: جملة واحدة تقول ما يُفعل */
.empty { font-size: 13.5px; font-weight: 500; line-height: 1.75; }

/* الاسم الطويل يُقصّ ولا يدفع الرقم خارج الصفّ */
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* حالة الحفظ: تظهر لحظةً بعد جواب الخادم ثم تختفي، بلا alert */
.saved { font-size: 10.5px; font-weight: 500; color: var(--ok); }

.field:focus-visible, .btn:focus-visible, .chip:focus-visible,
.seg button:focus-visible, .cal button:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* التحرّكات في المدى المسموح، ويُصفّرها استعلام تقليل الحركة أعلاه */
.btn, .chip, .cal button, .seg button, .tab { transition: background-color .14s ease, border-color .14s ease, color .14s ease; }

/* النصّ اللاتينيّ داخل جملة عربية يُعزل، وإلّا انتقلت النقطة والفاصلة
   إلى الجهة الخطأ منه (‎.env.local‎ تظهر ‎env.local.‎). */
code, .ltr { direction: ltr; unicode-bidi: isolate; }
code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: .92em;
}

/* جدول التقارير: خمس لجان + عمود المعدّل لا تسع في 390px، فالاسم كان
   ينسحق إلى حرف واحد. التمرير أفقيّ داخل الحاوية وحدها — لا الصفحة —
   والاسم مثبَّت لأن الرقم بلا اسمه لا معنى له. */
.tablewrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  /* الحدّ والقصّ ينتقلان إلى الحاوية: ‎overflow: hidden‎ على ‎.list‎ يجعلها
     هي حاوية التمرير فلا يثبت شيء داخلها — وهذا ما أخفى عمود المعدّل. */
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.tablewrap > .list {
  inline-size: max-content; min-inline-size: 100%;
  border: 0; border-radius: 0; overflow: visible;
}
.namecol {
  position: sticky; inset-inline-start: 0; z-index: 1;
  flex: 0 0 134px; min-inline-size: 134px;
  padding-inline: 16px 8px;
  background: var(--surface);
}
.row.quiet > .namecol { background: var(--surface-2); }

/* المعدّل مثبَّت في الطرف الآخر: هو العمود الوحيد الذي تُقارن به الطلاب،
   فدفنه خلف التمرير يُفقد الجدول معناه. والحدّ يفصله عن الأعمدة المارّة. */
.totalcol {
  position: sticky; inset-inline-end: 0; z-index: 1;
  flex: 0 0 66px; min-inline-size: 66px;
  padding-inline: 8px 16px;
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
}
.row.quiet > .totalcol { background: var(--surface-2); }
