/* ==========================================================================
   Dammam Valley — Employee Performance Evaluation
   style.css
   --------------------------------------------------------------------------
   Colours, typography and the angular graphic system all follow
   "Dammam Valley — Brand Guidelines 2026, Version .01".

     1.  Design tokens (brand)
     2.  Reset & base
     3.  Layout primitives
     4.  Buttons & pills
     5.  Top bar & footer
     6.  Home view
     7.  Evaluation view: rail, progress, wizard
     8.  Cards & form controls
     9.  Rating scale (5-point)
    10.  Summary
    11.  Modal & toast
    12.  Success view
    13.  Responsive
    14.  RTL, motion, print
   ========================================================================== */

/* 1. DESIGN TOKENS
   ------------------------------------------------------------------------ */
:root {
  /* --- Brand primaries (Guidelines §03) --- */
  --navy:        #0B1E41;   /* primary dark — headings, ink, dark surfaces */
  --navy-700:    #143059;
  --navy-100:    #E3E8F0;
  --navy-050:    #F2F5F9;

  --teal:        #00B1B2;   /* primary accent */
  --teal-600:    #009697;
  --teal-100:    #DCF3F3;
  --teal-050:    #F0FAFA;

  --green:       #35B27C;   /* the green end of the emblem gradient */
  --blue:        #1B5FA0;   /* the blue end of the emblem gradient */

  /* The emblem gradient: blue → teal → green. Used for progress and accents. */
  --grad: linear-gradient(100deg, var(--blue) 0%, var(--teal) 55%, var(--green) 100%);

  /* --- Neutrals --- */
  --bg:          #FFFFFF;
  --surface:     #F4F6F8;
  --surface-2:   #ECEFF3;
  --line:        #E1E5EA;
  --line-strong: #CCCCCC;   /* brand neutral */

  /* --- Text --- */
  --ink:   var(--navy);
  --ink-2: #3F4A5C;
  --ink-3: #46536B;   /* AA on white — used for lead text, descriptions */
  --ink-4: #64718A;   /* AA on white — used for hints, meta, placeholders */

  --danger:     #C0392B;
  --danger-050: #FDF2F1;

  /* --- Radii: softened, but kept tighter than a consumer app.
         The brand's geometry is angular; corners stay disciplined. --- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* --- Soft shadows --- */
  --sh-1: 0 1px 2px rgba(11, 30, 65, .04), 0 1px 3px rgba(11, 30, 65, .05);
  --sh-2: 0 2px 6px rgba(11, 30, 65, .05), 0 10px 28px rgba(11, 30, 65, .07);
  --sh-3: 0 16px 48px rgba(11, 30, 65, .18);
  --sh-teal: 0 6px 18px rgba(0, 177, 178, .28);

  /* --- Spacing --- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 80px;

  /* --- Type (Guidelines §04: IBM Plex Sans Arabic, AR + EN) --- */
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --fast: 140ms;
  --base: 240ms;

  --maxw: 1220px;
  --topbar-h: 96px;
}

/* 2. RESET & BASE
   ------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* عمود رأسي بارتفاع الشاشة كاملًا: يبقى التذييل في الأسفل مهما قصر المحتوى. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;              /* يدفع التذييل إلى القاع */
  display: flex;               /* ليتمدّد القسم النشط ويملأ الارتفاع كاملًا */
  flex-direction: column;
}
/* القسم الظاهر يتمدّد ليملأ ما بين الهيدر والتذييل، فتستطيع الشاشات
   القصيرة (إدخال الرقم، خيار المدير) توسيط بطاقتها عموديًّا بدل
   التصاقها بالأعلى وترك فراغ كبير تحتها. */
main > .view:not([hidden]) {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* [hidden] wins over any component `display` rule. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; inset-inline-start: var(--s-4); top: -60px; z-index: 100;
  padding: 10px 16px;
  background: var(--navy); color: #fff;
  border-radius: var(--r-sm); text-decoration: none;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: var(--s-3); }

/* 3. LAYOUT PRIMITIVES
   ------------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--s-6);
}

.view { animation: viewIn var(--base) var(--ease) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* 4. BUTTONS & PILLS
   ------------------------------------------------------------------------ */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-bd: transparent;

  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 11px 18px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 15px; font-weight: 500;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--base) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn--primary {
  --btn-bg: var(--navy);
  --btn-fg: #fff;
  --btn-bd: var(--navy);
  box-shadow: 0 6px 18px rgba(11, 30, 65, .22);
}
.btn--primary:hover { --btn-bg: var(--navy-700); --btn-bd: var(--navy-700); }

.btn--ghost {
  --btn-bg: #fff; --btn-bd: var(--line-strong); --btn-fg: var(--ink);
  box-shadow: var(--sh-1);
}
.btn--ghost:hover { --btn-bg: var(--surface); --btn-bd: var(--teal); --btn-fg: var(--teal-600); }

.btn--subtle { --btn-fg: var(--ink-3); }
.btn--subtle:hover { --btn-bg: var(--surface-2); --btn-fg: var(--ink); }

/* زر خطر: للحذف النهائي. أحمر ممتلئ ليؤكّد جسامة الإجراء. */
.btn--danger { --btn-bg: var(--danger); --btn-bd: var(--danger); --btn-fg: #fff; }
.btn--danger:hover { --btn-bg: #A93226; --btn-bd: #A93226; --btn-fg: #fff; }

.btn--lg  { padding: 15px 28px; font-size: 15.5px; border-radius: var(--r-lg); }
.btn--sm  { padding: 8px 12px; font-size: 13px; }

/* The primary CTA carries the emblem gradient on its underside. */
.btn--primary.btn--lg { position: relative; overflow: hidden; }
.btn--primary.btn--lg::after {
  content: "";
  position: absolute; inset-inline: 0; bottom: 0; height: 3px;
  background: var(--grad);
}

.btn i.fa-arrow-right, .btn i.fa-arrow-left { transition: transform var(--fast) var(--ease); }
.btn--primary:hover i.fa-arrow-right { transform: translateX(3px); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--teal-100);
  color: var(--teal-600);
  font-size: 12.5px; font-weight: 500;
}

/* 5. TOP BAR & FOOTER
   ------------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }

.brand { display: flex; align-items: center; text-decoration: none; }
.brand__logo { height: 44px; width: auto; }   /* رمز وادي الدمام */

.topbar__actions { display: flex; align-items: center; gap: var(--s-3); }

/* رابط نصي هادئ لمدخل الموارد البشرية */
.toplink {
  display: inline-flex; align-items: center; gap: var(--s-2);
  color: var(--navy);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.toplink i { color: var(--navy); font-size: 13px; transition: color var(--fast) var(--ease); }
/* التمرير يبقى فيروزيًا: هو لون التفاعل في كل الواجهة، ويمنح الرابط دلالة
   واضحة على أنه قابل للنقر بعد أن صار لونه الأساسي داكنًا كنص عادي. */
.toplink:hover { color: var(--teal-600); border-bottom-color: var(--teal); }
.toplink:hover i { color: var(--teal-600); }

/* زر الخروج: محايد عادةً، بلمسة حمراء عند المرور تشير إلى مغادرة الجلسة. */
.toplink--logout:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-050); }
.toplink--logout:hover i { color: var(--danger); }

/* زر حذف الاستجابة في شاشة الملخّص: لمسة حمراء عند المرور. */
.detail__del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-050); }
.detail__del:hover i { color: var(--danger); }


/* Compact navy footer — a survey needs a signature, not a sitemap.
   On a dark ground the logo must be the all-white version (Guidelines §01). */
.footer {
  position: relative;
  flex-shrink: 0;
  margin-top: var(--s-9);
  background: var(--navy);
  color: #fff;
}
/* شاشة الدخول لها خلفية ممتدّة حتى التذييل؛ هامش التذييل العلوي يترك شريطًا
   أبيض بينهما، فنُلغيه ما دامت هذه الشاشة هي الظاهرة. */
body:has(#view-login:not([hidden])) .footer { margin-top: 0; }
.footer::before {
  content: "";
  position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: var(--grad);
}
.footer__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
  padding-block: var(--s-5);
  font-size: 13.5px;
}
.footer__logo { height: 38px; width: auto; flex: 0 0 auto; }   /* الشعار الأبيض الكامل: اسم + رمز */
.footer__copy { color: #fff; }
.footer__links { display: inline-flex; align-items: center; gap: var(--s-4); }
.footer__link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  color: #fff;
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}
.footer__link i { color: var(--teal); font-size: 13px; }
.footer__link:hover { color: var(--teal); }


/* 6. HOME VIEW
   ------------------------------------------------------------------------ */
.hero {
  padding-block: var(--s-9) var(--s-8);
}
.hero__copy { max-width: 780px; }

/* ── زخرفة الرمز ─────────────────────────────────────────────────────
   تظهر على الشاشات الواسعة فقط. على الشاشات الضيقة تُخفى تمامًا: المساحة
   هناك للمحتوى، وعلامة مائية خلف نص عربي تضر بالقراءة أكثر مما تزيّن. */
.hero__art { display: none; }

@media (min-width: 1040px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    align-items: center;
    gap: var(--s-9);
  }

  .hero__art {
    display: block;
    position: relative;
    height: 400px;
    pointer-events: none;   /* لا يعترض النقر على ما تحته */
    user-select: none;
  }

  .hero__art svg {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    height: 460px;          /* أكبر قليلاً من حاويته ليمتلئ العرض الجانبي بأناقة */
    width: auto;
    opacity: 1;             /* رسمة مسطّحة مملوءة بألوان الهوية؛ لا تشفيف كالخطوط السابقة */
    overflow: visible;
  }
}

/* الطباعة: زخرفة لا مكان لها على الورق. */
@media print { .hero__art { display: none !important; } }

.hero__title {
  margin: 0 0 var(--s-4);
  font-size: clamp(32px, 4vw, 50px);
  font-weight: 600;
  line-height: 1.4;              /* Arabic ascenders/descenders need the room */
  color: var(--navy);
}

.hero__lead { max-width: 58ch; font-size: 17.5px; line-height: 1.95; color: var(--ink-3); }

/* Button first, its caveat directly beneath — the note is about the button,
   so it belongs under it, not competing for the same line. */
.hero__cta {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3);
  margin-top: var(--s-7);
}
.hero__buttons { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-7); }
.hero__buttons .hr-link { position: relative; }
.hero__note { margin-top: var(--s-4); }
.hero__note {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-4); font-size: 14px;
}

/* حالة ما بعد الإرسال: تحل محل زر البدء */
.hero__done {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  max-width: 520px;
  border: 1px solid var(--teal-100);
  border-radius: var(--r-lg);
  background: var(--teal-050);
}
.hero__done-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: var(--r-full);
  background: var(--teal); color: #fff;
  font-size: 16px;
}
.hero__done-title { color: var(--navy); font-weight: 600; font-size: 16px; }
.hero__done-text { font-size: 14px; color: var(--ink-3); }
.hero__done-text a { color: var(--teal-600); font-weight: 500; }

.hero__steps {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-5);
  margin-top: var(--s-8); padding-top: var(--s-6);
  border-top: 1px solid var(--line);
}
.hero__steps li { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-3); font-size: 15px; }

/* The brand's slanted rectangle, shrunk to a bullet. */
.hero__mark {
  width: 16px; height: 10px; flex: 0 0 16px;
  background: var(--grad);
  transform: skewX(-20deg);
}

/* 7. EVALUATION VIEW
   ------------------------------------------------------------------------ */
.evaluate {
  display: grid;
  /* عمود واحد: مسار الخطوات صار أفقيًّا في أعلى البطاقة بدل شريط جانبي.
     نحدّ العرض ونتوسّط، فالسطر الطويل جدًّا مُتعب للقراءة والأزرار تتباعد. */
  grid-template-columns: minmax(0, 1fr);
  max-width: 940px;
  margin-inline: auto;
  gap: var(--s-8);
  padding-block: var(--s-8);
  align-items: start;
}
/* أثناء شاشة خيار المدير: نخفي القائمة الجانبية وتتوسّع البطاقة. */
/* is-choice تُستخدم لشاشتين قصيرتين: إدخال الرقم، وخيار المدير. نجعلهما
   تتوسّطان عموديًّا بدل الالتصاق بالأعلى وترك فراغ كبير تحتهما. */
.evaluate.is-choice {
  /* نتحوّل من شبكة إلى flex هنا: عنصر واحد (البطاقة) يتمركز عموديًّا
     وأفقيًّا بشكل موثوق، بدل بقائه ملتصقًا بأعلى الشبكة. */
  display: flex;
  flex-direction: column;
  justify-content: center;   /* توسيط عمودي */
  align-items: center;       /* توسيط أفقي */
  flex: 1 0 auto;
  padding-block: var(--s-6);
}
/* البطاقة تأخذ عرضها المحدّد لا عرض الحاوية كاملًا. */
.evaluate.is-choice .wizard { width: 100%; }
.evaluate.is-choice .steps { display: none; }
.evaluate.is-choice .wizard__head { display: none; }
/* في هذا الوضع يتوسّط محتوى الخطوة في بطاقة كبيرة (الرقم أو خيار المدير). */
.evaluate.is-choice #stepContainer { max-width: 680px; margin: 0 auto; }
/* توسيط محتوى بطاقة الرقم: العنوان والأيقونة والوصف والحقل — كلها في الوسط. */
.evaluate.is-choice .card { padding: var(--s-9) var(--s-8); }
.evaluate.is-choice .card__head {
  flex-direction: column; align-items: center; text-align: center; gap: var(--s-3);
}
.evaluate.is-choice .card__head .card__title,
.evaluate.is-choice .card__head .card__desc { text-align: center; }
/* شبكة الحقول: الحقل يمتدّ العرض الكامل (لا نصف الشبكة) ليتوسّط فعليًّا. */
.evaluate.is-choice .grid { grid-template-columns: 1fr; justify-items: center; }
.evaluate.is-choice .field {
  align-items: center; width: 100%; max-width: 360px; margin: 0 auto;
}
.evaluate.is-choice .field > label { text-align: center; }
.evaluate.is-choice .field .input,
.evaluate.is-choice .field input { text-align: center; }
/* الأزرار تحت البطاقة، على اليسار دائمًا — بصرف النظر عن ظهور «السابق» من
   عدمه. margin-inline-start:auto على المجموعة يدفعها لأقصى اليسار في RTL
   حتى لو كانت العنصر الوحيد في الحاوية (كما في خطوة الرقم، حيث «السابق» مخفي). */
.evaluate.is-choice .wizard__actions {
  max-width: 680px; margin: var(--s-5) auto 0;
  justify-content: flex-start;
}
.evaluate.is-choice .wizard__actions-right {
  margin-inline-start: auto;
}
.mchoice { max-width: 640px; margin: 0 auto; text-align: center; padding: var(--s-4) 0; }
.mchoice--card { padding: var(--s-9) var(--s-7); }
.mchoice__select-wrap { max-width: 380px; margin: 0 auto; }
.mchoice__select {
  width: 100%; padding: 13px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: #fff; font: inherit; font-size: 15px; color: var(--ink);
  cursor: pointer; text-align: center;
  transition: border-color var(--fast) var(--ease);
}
.mchoice__select:focus { outline: none; border-color: var(--teal); }
.mchoice__error { margin-top: var(--s-3); color: var(--danger); font-size: 13px; }

/* --- مسار الخطوات الأفقي (كان شريطًا جانبيًّا) --- */
/* بطاقة رمادية خفيفة تحتضن المسار فيبدو وحدة مستقلّة واضحة. */
.steps {
  margin-bottom: var(--s-5);
  padding: var(--s-5) var(--s-4) var(--s-4);
  background: var(--navy-050);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.steps__list {
  display: flex; align-items: flex-start;
  list-style: none; margin: 0; padding: 0;
}
/* كل خطوة تتمدّد بالتساوي، ويربطها خط بالتالية. */
.steps__item {
  position: relative;
  flex: 1 1 0; min-width: 0;
  display: flex; justify-content: center;
}
/* الخط الواصل: يُرسم على يمين كل خطوة (عدا الأولى) ليصل بينها وبين السابقة.
   نرسمه على ::before بعرض نصف الخطوة من كل جانب، فيلتقي الخطان في المنتصف. */
.steps__item::before,
.steps__item::after {
  content: "";
  position: absolute;
  top: 15px;                       /* منتصف الدائرة */
  width: calc(50% - 20px);
  height: 2px;
  background: var(--line-strong);
  transition: background var(--base) var(--ease);
}
.steps__item::before { inset-inline-end: calc(50% + 20px); }
.steps__item::after  { inset-inline-start: calc(50% + 20px); }
/* لا خط قبل الأولى ولا بعد الأخيرة. */
.steps__item:first-child::before,
.steps__item:last-child::after { display: none; }
/* الخطوط المؤدّية للخطوات المكتملة/الحالية تتلوّن بلون الهوية. */
.steps__item.is-done::before,
.steps__item.is-done::after,
.steps__item.is-current::before { background: var(--teal); }

.steps__btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%;
  padding: 0 var(--s-2);
  border: 0; background: transparent;
  color: var(--ink-4);
  font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-align: center;
  transition: color var(--fast) var(--ease);
}
.steps__btn:hover { color: var(--ink); }

.steps__marker {
  position: relative; z-index: 1;      /* فوق الخط الواصل */
  display: grid; place-items: center;
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: var(--r-full);
  border: 2px solid var(--line-strong);
  background: #fff;
  font-size: 13px; font-weight: 700; color: var(--ink-4);
  transition: all var(--fast) var(--ease);
}
.steps__label {
  display: block; line-height: 1.35;
  overflow-wrap: anywhere;
}

/* الخطوة الحالية */
.steps__btn[aria-current="step"] { color: var(--navy); font-weight: 600; }
.steps__btn[aria-current="step"] .steps__marker {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: 0 0 0 4px var(--teal-050);
}
/* الخطوات المكتملة: علامة صح بدل الرقم */
.steps__btn.is-done { color: var(--ink-2); }
.steps__btn.is-done .steps__marker {
  background: var(--teal); border-color: var(--teal); color: #fff;
}
.steps__btn.is-done .steps__marker::before {
  content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 12px;
}
.steps__btn.is-done .steps__marker span { display: none; }

/* --- Progress --- */
.wizard__head { margin-bottom: var(--s-5); }
.wizard__meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s-3); }
.wizard__count { color: var(--ink); font-weight: 600; font-size: 15px; }
.wizard__pct { color: var(--ink-4); font-size: 14px; }

.progress { height: 6px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress__bar {
  height: 100%; width: 0;
  background: var(--grad);
  border-radius: inherit;
  transition: width 420ms var(--ease);
}

/* --- Sticky actions --- */
.wizard__actions {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  margin-top: var(--s-6);
  padding: var(--s-4) 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 32%);
}
.wizard__actions-right { display: flex; align-items: center; gap: var(--s-3); }

/* 8. CARDS & FORM CONTROLS
   ------------------------------------------------------------------------ */
.card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--s-6);
  overflow: hidden;
  transition: box-shadow var(--base) var(--ease), border-color var(--base) var(--ease);
}
.card + .card { margin-top: var(--s-5); }
.card:hover { box-shadow: var(--sh-2); border-color: var(--line-strong); }

/* A slanted brand rectangle sits quietly in the corner of every card. */
.card::after {
  content: "";
  position: absolute; top: -18px; inset-inline-end: -26px;
  width: 96px; height: 46px;
  background: var(--surface);
  transform: skewX(-20deg);
  pointer-events: none;
}

.card__head {
  position: relative; z-index: 1;
  display: flex; align-items: flex-start; gap: var(--s-4);
  padding-bottom: var(--s-5); margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}
.card__icon {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: var(--r-md);
  background: var(--navy-050);
  border: 1px solid var(--navy-100);
  color: var(--navy);
  font-size: 15px;
}
.card__title { font-size: 19px; }
.card__title-ar { display: block; font-size: 13px; font-weight: 400; color: var(--ink-4); margin-top: 1px; }
.card__desc { margin-top: 4px; font-size: 15px; color: var(--ink-3); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
.field--full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }

/* ══ شاشة خيار المدير (تقييم نفسي / موظفيّ) ══════════════════════════
   بطاقتان متجاورتان؛ عند المرور تتدرّج البطاقة كاملةً بألوان الهوية
   ويقلب النص للأبيض. */
.mchoice__greet {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 6px 16px; margin-bottom: var(--s-5);
  border-radius: var(--r-full);
  background: var(--teal-050); border: 1px solid var(--teal-100);
  color: var(--teal-600); font-size: 13px; font-weight: 500;
}
.mchoice__title { font-size: 23px; font-weight: 700; color: var(--navy); margin: 0 0 6px; }
.mchoice__sub { font-size: 14.5px; color: var(--ink-3); margin: 0 0 var(--s-7); }
.mchoice__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5);
}
.mcard {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  text-align: center;
  padding: var(--s-7) var(--s-5);
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  background: #fff; cursor: pointer; font-family: inherit;
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease),
              background var(--base) var(--ease), border-color var(--base) var(--ease);
}
.mcard__icon {
  width: 62px; height: 62px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy-050); color: var(--navy);
  transition: background var(--base) var(--ease), color var(--base) var(--ease);
}
.mcard__icon i { font-size: 31px; }
.mcard__icon--teal { background: var(--teal-050); color: var(--teal-600); }
.mcard__title { display: block; font-size: 17px; font-weight: 600; color: var(--navy); transition: color var(--base) var(--ease); }
.mcard__desc { display: block; font-size: 13px; color: var(--ink-3); margin-top: 5px; transition: color var(--base) var(--ease); }

/* المرور: تدرّج الهوية كامل + نص أبيض + رفعة */
.mcard:hover {
  background: var(--grad);
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(11, 30, 65, .22);
}
.mcard:hover .mcard__title,
.mcard:hover .mcard__desc { color: #fff; }
.mcard:hover .mcard__icon {
  background: rgba(255, 255, 255, .22); color: #fff;
}
/* بطاقة معطّلة (مثلاً «تقييم نفسي» بعد إرساله): باهتة، بلا تأثير تحويم. */
.mcard--disabled {
  opacity: .5; cursor: not-allowed;
}
.mcard--disabled:hover {
  background: #fff; border-color: var(--line); transform: none; box-shadow: none;
}
.mcard--disabled:hover .mcard__title { color: var(--navy); }
.mcard--disabled:hover .mcard__desc { color: var(--ink-3); }
.mcard--disabled:hover .mcard__icon { background: var(--navy-050); color: var(--navy); }
@media (max-width: 560px) {
  .mchoice__grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .mcard, .mcard__icon, .mcard__title, .mcard__desc { transition: none; }
  .mcard:hover { transform: none; }
}

.label { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.label .req { color: var(--teal-600); font-weight: 600; }
/* شارة الحقل الاختياري: أخفت من التسمية عمدًا، فهي معلومة ثانوية لا تنبيه. */
.label .opt { color: var(--ink-4); font-weight: 400; font-size: 12px; }

/* --- Required-field errors -------------------------------------------------
   Every step is mandatory except ملاحظات إضافية. A missing answer is flagged
   on the field itself, not just announced in a toast the user has to remember. */
.field.is-error .input,
.field.is-error .select,
.field.is-error .textarea {
  border-color: var(--danger);
  background: var(--danger-050);
}
.field.is-error .label { color: var(--danger); }

.question.is-error,
.criterion.is-error {
  border-inline-start: 3px solid var(--danger);
  background: var(--danger-050);
  padding-inline-start: var(--s-4);
  border-radius: var(--r-sm);
}
.question.is-error .scale__box,
.criterion.is-error .scale__box { border-color: #E8B4AE; }
.hint { font-size: 13px; color: var(--ink-4); }

/* --- حالة الرقم الوظيفي أسفل الحقل ---------------------------------------- */
/* رسالة الخطأ التي يكتشفها زر «التالي» (رقم غير موجود، فارغ، تعذّر الاتصال). */
.lookup__status { font-size: 13px; margin-top: 2px; }
.lookup__status--error   { color: var(--danger); }
.counter { align-self: flex-end; font-size: 11.5px; color: var(--ink-4); }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 15.5px;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-100);
}
.textarea { resize: vertical; min-height: 116px; line-height: 1.6; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2346536B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-inline-end: 38px;
  cursor: pointer;
}
[dir="rtl"] .select { background-position: left 14px center; }

/* 9. RATING SCALE
   ------------------------------------------------------------------------ */
.question { padding: var(--s-5) 0; border-bottom: 1px solid var(--line); }
.question:first-of-type { padding-top: 0; }
.question:last-of-type { border-bottom: 0; padding-bottom: 0; }

.question__head { display: flex; gap: var(--s-3); margin-bottom: var(--s-4); }
.question__num {
  flex: 0 0 auto; min-width: 26px; height: 26px;
  display: grid; place-items: center; padding-inline: 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-3); font-size: 11.5px; font-weight: 600;
}
.question__text { color: var(--ink); font-weight: 500; font-size: 16px; }
.question__hint { margin-top: 3px; font-size: 13.5px; color: var(--ink-4); }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2); }
.scale__opt { position: relative; }
.scale__input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.scale__box {
  display: grid; place-items: center; gap: 1px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-3);
  font-weight: 600; font-size: 17px;
  transition: all var(--fast) var(--ease);
  pointer-events: none;
}
.scale__box small { font-size: 10.5px; font-weight: 500; color: var(--ink-4); text-transform: uppercase; letter-spacing: .02em; }

.scale__input:hover + .scale__box {
  border-color: var(--teal);
  background: var(--teal-050);
  color: var(--teal-600);
  transform: translateY(-1px);
}
.scale__input:focus-visible + .scale__box { outline: 2px solid var(--teal); outline-offset: 2px; }
.scale__input:checked + .scale__box {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: var(--sh-teal);
}
.scale__input:checked + .scale__box small { color: rgba(255, 255, 255, .82); }

.scale__legend { display: flex; justify-content: space-between; margin-top: var(--s-2); font-size: 12.5px; color: var(--ink-4); }

/* الكفاءة: السؤال في الأعلى، ومقياس الدرجات تحته بعرض كامل — أوضح للقراءة
   وأسهل للنقر من وضعه في عمود ضيّق بجانب النص. */
.criterion {
  display: grid; grid-template-columns: 1fr;
  gap: var(--s-4);
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--line);
}
.criterion:first-child { padding-top: 0; }
.criterion:last-child { border-bottom: 0; padding-bottom: 0; }
.criterion__head { display: flex; gap: var(--s-3); align-items: flex-start; }
.criterion__num {
  flex: 0 0 auto;
  min-width: 28px; height: 28px;
  display: grid; place-items: center;
  padding-inline: 6px;
  border-radius: var(--r-sm);
  background: var(--navy-050);
  border: 1px solid var(--navy-100);
  color: var(--navy);
  font-size: 12.5px; font-weight: 600;
}
.criterion__name { color: var(--ink); font-weight: 500; font-size: 16px; }
.criterion__desc { margin-top: 3px; font-size: 14.5px; line-height: 1.75; color: var(--ink-4); }

/* 10. MODAL & TOAST
   ------------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: var(--s-5); }
.modal__scrim {
  position: absolute; inset: 0;
  background: rgba(11, 30, 65, .55);
  backdrop-filter: blur(3px);
  animation: fadeIn var(--base) var(--ease) both;
}
.modal__dialog {
  position: relative; overflow: hidden;
  width: min(480px, 100%);
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  padding: var(--s-8) var(--s-7);
  text-align: center;
  animation: popIn var(--base) var(--ease) both;
}
.modal__dialog::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--grad);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal__icon {
  display: grid; place-items: center;
  width: 52px; height: 52px; margin: 0 auto var(--s-4);
  border-radius: var(--r-md);
  background: var(--navy-050); border: 1px solid var(--navy-100);
  color: var(--navy); font-size: 20px;
}
/* نسخة إعلامية بلون الهوية الفيروزي، لنافذة "سبق التقييم". */
.modal__icon--info {
  background: var(--teal-050); border-color: var(--teal-100); color: var(--teal-600);
}
/* نسخة خطر بالأحمر، لنافذة تأكيد الحذف. */
.modal__icon--danger {
  background: var(--danger-050); border-color: #F3C9C4; color: var(--danger);
}
.modal__title { font-size: 20px; }
.modal__desc { margin-top: var(--s-2); font-size: 15px; color: var(--ink-3); }

/* تنفّس إضافي لنافذة "سبق التقييم": الوصف أوسع سطرًا، ومسافة أكبر قبل الزر. */
#alreadyModal .modal__icon { margin-bottom: var(--s-5); }
#alreadyModal .modal__desc { margin-top: var(--s-3); line-height: 1.85; max-width: 42ch; margin-inline: auto; }
#alreadyModal .modal__actions { margin-top: var(--s-7); }

.modal__facts {
  margin: var(--s-5) 0;
  padding: var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  text-align: start;
}
.modal__facts li { display: flex; justify-content: space-between; gap: var(--s-4); padding: 6px 0; font-size: 14.5px; }
.modal__facts li span:first-child { color: var(--ink-4); }
.modal__facts li span:last-child { color: var(--ink); font-weight: 500; }

.modal__actions { display: flex; gap: var(--s-3); }
.modal__actions .btn { flex: 1; }
/* زر واحد وسط النافذة: لا يُمدّ بعرضها كاملًا بل يأخذ حجمه الطبيعي. */
.modal__actions--center { justify-content: center; }
.modal__actions--center .btn { flex: 0 1 auto; min-width: 200px; }

.toast {
  position: fixed; left: 50%; bottom: 120px; z-index: 95;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s-2);
  padding: 12px 20px;
  border-radius: var(--r-full);
  /* زجاج ضبابي واضح بذاته: طبقتان — لون شبه شفاف + لمعان علوي خفيف — فيبدو
     زجاجيًّا حتى فوق خلفية بلون واحد (كالتذييل)، لا يعتمد على تباين ما خلفه. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 42%),
    rgba(20, 42, 78, .62);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(11, 30, 65, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
  animation: toastIn 220ms var(--ease) both;
}
.toast i { color: var(--teal); }
/* دخول خفيف: انزلاق قصير من الأسفل مع تلاشٍ — مثل إشعارات الجوال. */
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
/* خروج ناعم بنفس الروح: يتلاشى وينزلق قليلًا للأسفل. */
.toast.is-leaving { animation: toastOut 240ms var(--ease) both; }
@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.is-leaving { animation: none; }
}

/* 11. SUCCESS VIEW
   ------------------------------------------------------------------------ */
.success { padding-block: var(--s-10); display: grid; place-items: center; }
.card--success {
  width: min(640px, 100%);
  padding: var(--s-8);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  text-align: center;
}
.card--success::after { display: none; }
.card--success::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--grad);
}
.success__mark {
  display: grid; place-items: center;
  width: 64px; height: 64px; margin: 0 auto var(--s-5);
  border-radius: var(--r-full);
  background: var(--teal-100); color: var(--teal-600);
  font-size: 24px;
  animation: markIn 460ms var(--ease) both;
}
@keyframes markIn {
  0%   { opacity: 0; transform: scale(.6); }
  60%  { transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
.success__title { font-size: 26px; }
.success__lead { margin-top: var(--s-3); color: var(--ink-3); font-size: 16px; }

.success__receipt {
  /* الأعمدة تتبع عدد العناصر الفعلي. تثبيتها على رقم يترك خانة فارغة
     تظهر كمستطيل رمادي عندما تكون العناصر أقل. */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1px;
  margin: var(--s-7) 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: start;
}
.success__receipt > div { background: #fff; padding: var(--s-4); }
.success__receipt dt { font-size: 12px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .07em; }
.success__receipt dd { margin: 4px 0 0; color: var(--ink); font-weight: 500; font-size: 15px; }

.success__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s-3); }

/* 12. RESPONSIVE
   ------------------------------------------------------------------------ */
@media (max-width: 1024px) {
  .hero { padding-block: var(--s-7); }

  .evaluate { grid-template-columns: 1fr; gap: var(--s-5); }
  /* على الشاشات الضيقة: نصغّر المسار ونُخفي الخط الواصل لتوفير المساحة. */
  .steps__marker { width: 28px; height: 28px; flex: 0 0 28px; font-size: 12px; }
  .steps__btn { font-size: 12px; gap: 6px; padding: 0 4px; }
  .steps__item::before, .steps__item::after { top: 13px; }

  .criterion { grid-template-columns: 1fr; gap: var(--s-3); }

}

@media (max-width: 720px) {
  :root { --topbar-h: 76px; }
  .container { padding-inline: var(--s-4); }

  .hero__steps { grid-template-columns: 1fr; }
  .hero__cta { align-items: stretch; }
  .hero__buttons { flex-direction: column; }
  .hero__cta .btn { width: 100%; }
  .hero__note { justify-content: center; }

  .grid { grid-template-columns: 1fr; gap: var(--s-4); }

  .card { padding: var(--s-5); }

  .scale { gap: 6px; }
  .scale__box { height: 46px; font-size: 14px; }
  .scale__box small { display: none; }

  .wizard__actions { flex-direction: column-reverse; align-items: stretch; gap: var(--s-2); padding-bottom: var(--s-5); }
  .wizard__actions-right { flex-direction: column-reverse; align-items: stretch; gap: var(--s-2); }
  .wizard__actions .btn { width: 100%; }

  .success__receipt { grid-auto-flow: row; }
  .success__actions .btn { width: 100%; }
  .modal__actions { flex-direction: column-reverse; }

  .brand__logo { height: 46px; }

  .footer__inner { flex-direction: column; gap: var(--s-3); text-align: center; }
  .footer__links { flex-wrap: wrap; justify-content: center; }
}

/* 13. RTL, MOTION, PRINT
   ------------------------------------------------------------------------ */
/* Arabic runs right-to-left. Logical properties handle most of it; these are
   the few directional flourishes that need mirroring. */
[dir="rtl"] .hero__mark,
[dir="rtl"] .card::after { transform: skewX(20deg); }

[dir="rtl"] .btn i.fa-arrow-right { transform: scaleX(-1); }
[dir="rtl"] .btn i.fa-arrow-left  { transform: scaleX(-1); }
[dir="rtl"] .btn--primary:hover i.fa-arrow-right { transform: scaleX(-1) translateX(3px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}



/* ==========================================================================
   شاشة تسجيل الدخول (بوابة واجهة)
   ========================================================================== */
/* شاشة الدخول: صورة مقرّ وادي الدمام كخلفية، فوقها تدرّج بألوان الهوية
   ليبقى النص والبطاقة واضحين تمامًا فوق الصورة. */
#view-login {
  position: relative;
  /* نترك flexbox يمدّد القسم ليملأ ما بين الهيدر والتذييل بدقّة، بدل حساب
     (100vh ناقص رقم ثابت) الذي يترك فراغًا أبيض حين تختلف أحجامهما. */
  display: flex; flex-direction: column;
  flex: 1 0 auto;
  background-image: url("../Assets/Images/login-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#view-login::before {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(135deg,
      rgba(11, 30, 65, .92) 0%,
      rgba(27, 95, 160, .86) 45%,
      rgba(0, 155, 160, .82) 75%,
      rgba(53, 178, 124, .80) 100%);
  pointer-events: none;
}
#view-login > .container { position: relative; z-index: 1; flex: 1 0 auto; }

.login {
  display: grid; place-items: center;
  padding-block: var(--s-8);
  /* لا نحسب ارتفاعًا هنا: القسم الأب (#view-login) يتكفّل بملء الشاشة،
     وهذه الحاوية تتمدّد داخله فتتوسّط البطاقة دون فراغ أسفل الخلفية. */
  min-height: 100%;
}
.login__card {
  width: min(440px, 100%);
  padding: var(--s-8);
  text-align: center;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
}
.login__card::after { display: none; }
.login__card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--grad);
}
.login__icon {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto var(--s-4);
  border-radius: var(--r-lg);
  background: var(--navy-050); border: 1px solid var(--navy-100);
  color: var(--navy); font-size: 22px;
}
.login__title { font-size: 22px; }
.login__sub { margin-top: var(--s-2); color: var(--ink-3); font-size: 14px; }

.login__form { margin-top: var(--s-6); text-align: start; display: flex; flex-direction: column; gap: var(--s-4); }
.login__pass { position: relative; }
.login__pass .input { padding-inline-start: 44px; }
.login__toggle {
  position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-4); font-size: 14px;
  border-radius: var(--r-sm);
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.login__toggle:hover { color: var(--teal-600); background: var(--surface); }

.login__error {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 10px var(--s-4);
  border-radius: var(--r-md);
  background: var(--danger-050);
  border: 1px solid #E8B4AE;
  color: var(--danger);
  font-size: 13.5px;
}
.login__submit { width: 100%; margin-top: var(--s-2); }

.login__note {
  margin-top: var(--s-6); padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-4);
}
.login__note strong { color: var(--ink-2); font-family: monospace; }


/* ==========================================================================
   12. HR DASHBOARD
   ========================================================================== */

/* Entry point in the top bar. The dot pulses only while something is unread. */
.hr-link { position: relative; }
@keyframes shine {
  0%   { box-shadow: 0 0 0 0 rgba(27, 95, 160, .55); }
  70%  { box-shadow: 0 0 0 9px rgba(27, 95, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(27, 95, 160, 0); }
}

.dash { padding-block: var(--s-8); }
.dash__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.dash__title { font-size: 26px; }
.dash__sub { margin-top: 4px; color: var(--ink-3); font-size: 14.5px; }
.dash__tools { display: flex; gap: var(--s-2); }

.dash__list { display: flex; flex-direction: column; gap: 6px; }

/* شريط الفلاتر: بحث مرن + ثلاث قوائم. يلتفّ على الشاشات الضيقة. */
.filters {
  display: flex; align-items: center; gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.filters__search {
  position: relative; flex: 1 1 240px; min-width: 200px;
  display: flex; align-items: center;
}
.filters__search i {
  position: absolute; inset-inline-start: 12px;
  color: var(--ink-4); font-size: 13px; pointer-events: none;
}
.filters__input {
  width: 100%;
  padding: 9px 36px 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: #fff; font: inherit; font-size: 14px; color: var(--ink);
  transition: border-color var(--fast) var(--ease);
}
.filters__input:focus { outline: none; border-color: var(--teal); }
.filters__select {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: #fff; font: inherit; font-size: 14px; color: var(--ink);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease);
}
.filters__select:focus { outline: none; border-color: var(--teal); }
.dash__reset { margin-top: var(--s-4); }

@media (max-width: 720px) {
  /* على الجوال: البحث سطر كامل، والقوائم تتوزّع تحته. */
  .filters { gap: var(--s-2); }
  .filters__search { flex: 1 1 100%; }
  .filters__select { flex: 1 1 calc(50% - var(--s-2)); }
}

/* رأس الجدول */
.dash__thead {
  display: grid;
  grid-template-columns: 2.4fr 1.3fr 1.6fr 1.2fr 48px;
  gap: var(--s-4);
  align-items: center;
  padding: 0 var(--s-5) var(--s-2);
  font-size: 12px; font-weight: 600; color: var(--ink-4);
  letter-spacing: .02em;
}
.dash__thead span { text-align: start; }

/* صف الاستجابة */
.drow {
  display: grid;
  grid-template-columns: 2.4fr 1.3fr 1.6fr 1.2fr 48px;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-3) var(--s-5);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), box-shadow var(--base) var(--ease),
              transform var(--fast) var(--ease);
}
.drow:hover { border-color: var(--teal); box-shadow: var(--sh-2); transform: translateY(-1px); }

.drow.is-unread { border-inline-start: 3px solid var(--blue); background: #F5F9FD; }

/* الموظف: نقطة + صورة رمزية + الاسم */
.drow__who { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.drow__dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: transparent; }
.drow.is-unread .drow__dot { background: var(--blue); animation: shine 1.9s var(--ease) infinite; }
.drow__avatar {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: var(--r-full);
  background: var(--navy-050);
  border: 1px solid var(--navy-100);
  color: var(--navy);
  font-size: 14px; font-weight: 600;
}
.drow.is-unread .drow__avatar { background: var(--navy); border-color: var(--navy); color: #fff; }
.drow__id { display: flex; flex-direction: column; min-width: 0; }
.drow__name { font-size: 15px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drow.is-unread .drow__name { font-weight: 600; color: var(--navy); }

.drow__dept, .drow__date { font-size: 13.5px; color: var(--ink-3); min-width: 0; }

/* شريط الاكتمال */
.drow__fill { display: flex; align-items: center; gap: var(--s-2); }
.drow__bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; min-width: 40px; }
.drow__bar > span { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.drow__fillnum { font-size: 12px; color: var(--ink-4); white-space: nowrap; }

/* شارة الحالة */
.chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.chip--new  { background: var(--blue); color: #fff; }
.chip--read { background: var(--surface-2); color: var(--ink-3); }

/* أزرار الإجراءات */
.drow__actions { display: flex; gap: 6px; justify-content: flex-end; }
.iconbtn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--fast) var(--ease);
}
.iconbtn--view:hover { border-color: var(--teal); color: var(--teal-600); background: var(--teal-050); }
.iconbtn--save:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-050); }
.iconbtn--del:hover  { border-color: var(--danger); color: var(--danger); background: var(--danger-050); }

.dash__empty {
  display: grid; place-items: center; gap: var(--s-2);
  padding: var(--s-10) var(--s-5);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-align: center;
}
.dash__empty i { font-size: 30px; color: var(--ink-4); margin-bottom: var(--s-2); }
.dash__empty p { color: var(--ink-3); }
.dash__empty-hint { font-size: 13.5px; color: var(--ink-4); max-width: 46ch; }

/* --- Response detail: a neat summary of what was actually filled --- */
.detail__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-5); flex-wrap: wrap;
  padding-bottom: var(--s-5); margin-bottom: var(--s-6);
  border-bottom: 2px solid var(--navy);
}
.detail__name { font-size: 24px; }
/* وسم نوع التقييم بجانب اسم الموظف: يميّز الذاتي عن تقييم المدير بلمحة. */
.dbadge {
  display: inline-block; vertical-align: middle;
  margin-inline-start: 10px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.dbadge--self { background: var(--teal-050); color: var(--teal-600); border: 1px solid var(--teal); }
.dbadge--mgr  { background: var(--navy-050); color: var(--navy); border: 1px solid var(--navy); }
/* وسم نوع التقييم داخل التقرير (نسخة الشاشة؛ نسخة الطباعة في كتلة @media print). */
.rbadge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; border: 1px solid currentColor;
}
.rbadge--self { color: var(--teal-600); background: var(--teal-050); }
.rbadge--mgr  { color: var(--navy); background: var(--navy-050); }
.detail__meta {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  margin-top: 4px;
  font-size: 14px; color: var(--ink-3);
}
.detail__count {
  padding: 6px 12px;
  border: 1px solid var(--teal-100);
  border-radius: var(--r-full);
  background: var(--teal-050);
  color: var(--teal-600);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
}

/* --- تفاصيل الاستجابة: أقسام الدرجات والملاحظات ------------------------- */
.dsec { margin-bottom: var(--s-6); }
.dsec__title {
  font-size: 15px; color: var(--ink-2); font-weight: 600;
  margin-bottom: var(--s-3);
}
.slist { list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) {
  /* كفاءتان جنب بعض على الشاشات الأوسع، اختصارًا للمساحة العمودية. */
  .slist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
}
.srow {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  margin-bottom: 6px;
}
@media (min-width: 640px) { .srow { margin-bottom: 0; } }
.srow__label { color: var(--ink); font-size: 14.5px; }
.srow__val {
  flex: 0 0 auto;
  min-width: 38px; text-align: center;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--navy-050); border: 1px solid var(--navy-100);
  color: var(--navy); font-weight: 600; font-size: 15px;
}
.dnote { margin-bottom: var(--s-4); }
.dnote h4 { font-size: 13px; color: var(--ink-4); margin: 0 0 4px; font-weight: 600; }
.dnote p { margin: 0; color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; }
.dnote__empty { color: var(--ink-4); font-style: italic; }

/* مؤشّر تحميل في اللوحة والتفاصيل. */
.dash__loading { text-align: center; padding: var(--s-8); color: var(--ink-4); font-size: 24px; }

/* سطر إرشاد أول دخول. */
.login__hint {
  display: flex; align-items: flex-start; gap: var(--s-2);
  margin-top: var(--s-2); font-size: 13px; color: var(--teal-600);
  line-height: 1.6;
}

/* ظهور ناعم لحقل التأكيد وسطر الإرشاد عند أول دخول: ينزلقان للأسفل مع تلاشٍ
   بدل الظهور الفوري المربك. العنصر يبدأ مطويًّا (hidden=false يزيل display:none،
   ثم صنف is-revealed يشغّل الانتقالة). */
#confirmField:not([hidden]),
#loginHint:not([hidden]) {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  margin-top: 0;
  transition: max-height .28s var(--ease), opacity .28s var(--ease),
              transform .28s var(--ease), margin-top .28s var(--ease);
}
#confirmField.is-revealed { max-height: 120px; opacity: 1; transform: none; margin-top: var(--s-4); }
#loginHint.is-revealed    { max-height: 60px;  opacity: 1; transform: none; margin-top: var(--s-2); }

/* من يفضّل تقليل الحركة: نُظهر بلا انتقالة. */
@media (prefers-reduced-motion: reduce) {
  #confirmField:not([hidden]), #loginHint:not([hidden]) {
    transition: none; max-height: none; opacity: 1; transform: none;
  }
}

.sum__section + .sum__section { margin-top: var(--s-6); }
.sum__h {
  font-size: 15px; font-weight: 600;
  color: var(--navy);
  padding: 7px var(--s-4);
  background: var(--surface);
  border-inline-start: 3px solid var(--teal);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-4);
}

/* الحقول القصيرة */
.sum__pairs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3) var(--s-5);
}
.sum__pairs dt { font-size: 12.5px; color: var(--ink-4); }
.sum__pairs dd { margin: 2px 0 0; font-size: 15px; color: var(--ink); font-weight: 500; }

/* التقييمات كصفوف واضحة: العبارة على جهة، والتقييم مع تسميته على الأخرى */
.ratings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px var(--s-5);
}
.ratings__row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: 11px var(--s-3);
  border-bottom: 1px solid var(--line);
}
/* الصف الفردي في العمود الأول يفصله خط خفيف عن الثاني */
.ratings__row:nth-last-child(-n+1):nth-child(odd) { border-bottom: 0; }
.ratings__label { display: flex; align-items: center; gap: var(--s-3); font-size: 14px; color: var(--ink); min-width: 0; }
.ratings__num {
  flex: 0 0 auto;
  min-width: 26px; height: 24px;
  display: grid; place-items: center;
  padding-inline: 5px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11.5px; font-weight: 600;
}
.ratings__value { display: flex; align-items: center; gap: var(--s-3); flex: 0 0 auto; }

.ratings__dots { display: inline-flex; gap: 3px; }
.ratings__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.ratings__dot.is-on { background: var(--teal); border-color: var(--teal); }

.ratings__score {
  min-width: 74px; text-align: start;
  font-size: 13px; font-weight: 600; color: var(--teal-600);
  white-space: nowrap;
}
.ratings__row.is-empty .ratings__score { color: var(--ink-4); font-weight: 400; font-style: italic; }

/* الملاحظات المكتوبة */
.sum__note {
  padding: var(--s-4);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
}
.sum__note-label { display: block; font-size: 12px; line-height: 1.3; color: var(--ink-4); }
.sum__note p { margin-top: 3px; font-size: 14.5px; color: var(--ink-2); line-height: 1.75; }
.sum__empty { color: var(--ink-4); font-style: italic; }

/* --- Response detail: the printable report, shown on screen --- */
.detail { padding-block: var(--s-7) var(--s-8); }
.detail__bar { display: flex; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-5); }
/* مجموعة (حفظ + حذف) معًا على اليسار؛ «عودة» تبقى يمينًا. */
.detail__actions { display: flex; align-items: center; gap: var(--s-2); }
/* زر أيقوني مربّع (سلة الحذف بلا نص). */
.btn--icon {
  width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; color: var(--ink-3); cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.btn--icon i { font-size: 16px; }
.detail__card { padding: var(--s-8); }
.detail__card::after { display: none; }

@media (max-width: 900px) {
  .detail__card { padding: var(--s-5); }
  .detail__head { flex-direction: column; gap: var(--s-3); }
}

/* --- التقرير القابل للطباعة / الحفظ كـ PDF ---------------------------------
   مخفي على الشاشة تمامًا؛ عند الطباعة يُخفى التطبيق ويظهر التقرير وحده. */
.report { display: none; }

@media print {
  /* margin-boxes مفرّغة: تمنع ظهور نصوص المتصفح التلقائية (الرابط، عنوان
     الصفحة، التاريخ، رقم الصفحة) في زوايا الورقة. المتصفحات الحديثة تحترمها،
     أما ترويسة/تذييل المتصفح الكاملة فيُطفئها المستخدم من إعدادات الطباعة. */
  @page {
    size: A4;
    /* الهامش السفلي ضيّق: رقم الصفحة يُرسم فيه، فكلّما ضاق اقترب من شريط
       التذييل وبدا معه سطرًا واحدًا بدل أن يبدو نازلًا في أسفل الورقة. */
    margin: 14mm 14mm 16mm;   /* مساحة كافية للتذييل في الهامش */
    @top-left     { content: ""; }
    @top-center   { content: ""; }
    @top-right    { content: ""; }
    /* التذييل كاملًا يُرسم في هوامش الورقة السفلية، فتقع أجزاؤه الثلاثة على
       سطر واحد متحاذٍ، ويتكرّر تلقائيًّا في كل صفحة برقمها الصحيح.
       (margin box هو المكان الوحيد الذي يفهم counter(page).) */
    @bottom-right {
      content: "شركة وادي الدمام القابضة";
      font-family: "IBM Plex Sans Arabic", sans-serif;
      font-size: 8pt; color: #0B1E41;
      vertical-align: top; padding-top: 6px;
    }
    @bottom-center{
      content: "صفحة " counter(page);
      font-family: "IBM Plex Sans Arabic", sans-serif;
      font-size: 8pt; color: #64718A;
      vertical-align: top; padding-top: 6px;
    }
    @bottom-left {
      content: "hrservices@dammamvalley.sa";
      font-family: "IBM Plex Sans Arabic", sans-serif;
      font-size: 8pt; color: #0B1E41;
      vertical-align: top; padding-top: 6px;
    }
  }

  .topbar, .footer, .modal, .toast, main { display: none !important; }

  body { background: #fff; color: #14181F; font-size: 10.5pt; line-height: 1.6; }

  .report {
    display: block; direction: rtl; font-family: var(--font);
    /* ترقيم الصفحات يعتمد على عدّاد المتصفّح المدمج (counter(page)). */
  }

  /* ترويسة التقرير: شعار وادي الدمام يمين، وبيانات التقرير يسار */
  .report__head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding-bottom: 9px; margin-bottom: 13px;
    border-bottom: 2px solid var(--navy);
  }
  .report__brand { height: 56px; width: auto; object-fit: contain; }
  .report__meta { text-align: start; }
  .report__title { font-size: 15pt; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
  .report__meta p { font-size: 9pt; color: #46536B; }

  /* الأقسام: عمود واحد، كل قسم أسفل الآخر */
  .report__body { display: block; }
  .report__section { margin-bottom: 11px; break-inside: avoid; }

  .report__h2 {
    font-size: 11.5pt; font-weight: 600; color: var(--navy);
    padding: 4px 9px; margin-bottom: 6px;
    background: #F1F4F8;
    border-inline-start: 3px solid var(--teal);
  }
  .report__h3 { font-size: 10pt; font-weight: 600; color: #46536B; margin: 7px 0 5px; }

  /* الجداول */
  .report__table { width: 100%; border-collapse: collapse; }
  .report__table th, .report__table td {
    border: 1px solid #D9DEE5;
    padding: 4px 9px;
    font-size: 9.5pt;
    text-align: start;
    vertical-align: top;
  }
  .report__table th { background: #FAFBFC; font-weight: 500; color: #46536B; }
  .report__table td { color: #14181F; }

  /* بطاقة البيانات: عمودان (الحقل / القيمة) */
  .report__table--pairs th { width: 32%; }

  /* وسم نوع التقييم داخل التقرير: إطار وخط عريض بدل خلفية ملوّنة، لأن
     المتصفّحات كثيرًا ما تُسقط ألوان الخلفية عند الطباعة. */
  .rbadge {
    display: inline-block; padding: 2px 10px;
    border-radius: 999px; font-weight: 700; font-size: 9.5pt;
    border: 1.2pt solid currentColor;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .rbadge--self { color: #00767A; }
  .rbadge--mgr  { color: #0B1E41; }

  /* البنود المُقيَّمة: رقم · العبارة · القيمة */
  .report__idx { width: 34px; text-align: center; color: #64718A; background: #FAFBFC; font-size: 9pt; }
  .report__table--rated th { font-weight: 400; color: #14181F; background: #fff; }
  .report__table--rated .report__val { width: 32%; font-weight: 600; color: var(--navy); white-space: nowrap; }

  /* الملاحظات المكتوبة */
  .report__note { border: 1px solid #D9DEE5; padding: 6px 9px; margin-bottom: 6px; break-inside: avoid; }
  .report__note h4 { font-size: 9.5pt; line-height: 1.3; font-weight: 600; color: var(--navy); margin-bottom: 3px; }
  .report__note p { font-size: 9.5pt; line-height: 1.4; }
  .report__empty { color: #93A0B0; font-style: italic; }

  /* التذييل يتكرّر أسفل كل صفحة مطبوعة (لا مرة واحدة في نهاية المحتوى):
     position:fixed داخل سياق الطباعة يجعل المتصفّح يرسمه في كل ورقة. */
  /* التذييل نفسه يُرسم عبر @bottom-* في هوامش الورقة (أعلاه)؛ نُبقي هنا
     خطًّا فاصلًا ثابتًا أسفل كل صفحة يفصل المحتوى عن التذييل. */
  .report__foot {
    position: fixed;
    bottom: 0; inset-inline: 0;
    height: 2px;
    background: var(--navy);
  }
  /* الشريط النصّي داخل المحتوى مُخفى: التذييل كله يُرسم عبر @bottom-* في
     هوامش الورقة. إظهاره هنا كان يجعله يطفو في أعلى الصفحات التالية
     ويتداخل مع العناوين. */
  .report__bar,
  .report__foot-start,
  .report__foot-end,
  .report__pageno { display: none; }
}
