/* ============================================================================
   athra.net — نظام تصميم بوابة العميل (OR-60)
   إيقاع مختلط كالرئيسية: رأس/تذييل فحميّ داكن + محتوى فاتح (ivory).
   يُخدَم من نفس الأصل (/portal-assets/portal.css) — متوافق مع style-src 'self'.
   القيم مأخوذة حرفيًا من tokens الموقع (public/index.html: 17–26). بلا JS.
   ========================================================================== */

:root {
  --graphite: #111315;
  --graphite-2: #16191B;
  --ivory: #F7F5F1;
  --on-dark: #F7F5F1;
  --on-light: #1B1B1B;
  --muted-dark: #9A948B;
  --muted-light: #6A6A6A;
  --bronze: #B88A44;
  --bronze-hi: #D7A45A;
  --bd-dark: rgba(247, 245, 241, .09);
  --bd-light: rgba(27, 27, 27, .10);

  /* ألوان الحالات (من الموقع) */
  --re: #2C6E8F;
  --ys: #2E8B6F;
  --be: #4B4DA6;
  --st: #C2536B;

  --font: "IBM Plex Sans Arabic", sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --card: #FFFFFF;
  --wrap: 1180px;
  --shadow-card: 0 1px 2px rgba(27, 27, 27, .04), 0 10px 30px -18px rgba(27, 27, 27, .25);
  --shadow-hover: 0 4px 10px rgba(27, 27, 27, .06), 0 22px 48px -22px rgba(184, 138, 68, .30);
}

/* ===== الأساس ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--ivory);
  color: var(--on-light);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--bronze); color: var(--ivory); }

a { color: inherit; text-decoration: none; transition: color .25s var(--ease); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 28px; }

.skip {
  position: absolute; inset-inline-start: -9999px; top: 8px; z-index: 200;
  background: var(--bronze); color: var(--graphite); font-weight: 600;
  padding: 10px 18px; border-radius: 8px;
}
.skip:focus { inset-inline-start: 16px; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }

/* ===== الأيقونات (Lucide عبر <use>) ===== */
.icon {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none; color: inherit;
  vertical-align: middle;
}
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ===== العلامة (regmark + الاسم) — تبقى برونزية على الداكن ===== */
.lockup { display: inline-flex; align-items: center; gap: 11px; color: var(--on-dark); }
.lockup .regmark { width: 22px; height: 22px; flex: none; }
.lockup .regmark circle { fill: none; stroke: var(--bronze); stroke-width: 1.4; }
.lockup .regmark line { stroke: var(--bronze); stroke-width: 1.4; }
.lockup .brand { font-weight: 700; font-size: 21px; letter-spacing: .3px; line-height: 1.05; }
.lockup .brand small {
  display: block; font-weight: 300; font-size: 9px; letter-spacing: 3.5px;
  color: var(--muted-dark); margin-top: 1px;
}

/* ===== الرأس — فحميّ داكن (كرونة الموقع) ===== */
.p-header {
  background: var(--graphite);
  color: var(--on-dark);
  border-bottom: 1px solid var(--bd-dark);
  position: sticky; top: 0; z-index: 100;
}
.p-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding-block: 16px; flex-wrap: wrap;
}
.p-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* روابط التنقّل (غير النشطة) — أزرار خافتة على الداكن */
.p-nav .nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500; color: var(--on-dark);
  padding: 8px 14px; border-radius: 7px; border: 1px solid transparent;
  transition: .25s var(--ease);
}
.p-nav .nav-link:hover { border-color: var(--bd-dark); color: var(--bronze-hi); }

/* العنصر النشط = مؤشّر «أنت هنا» — لا زرّ يُنقَر إلى نفسه */
.p-nav .nav-here {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 600; color: var(--bronze-hi);
  padding: 8px 6px; border: none; background: none; cursor: default;
  border-bottom: 2px solid var(--bronze);
  border-radius: 0;
}

.p-logout { display: inline-flex; align-items: center; margin-inline-start: 6px; }
.p-logout button {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--muted-dark); background: none; cursor: pointer;
  border: 1px solid var(--bd-dark); border-radius: 7px; padding: 8px 14px;
  transition: .25s var(--ease);
}
.p-logout button:hover { border-color: var(--st); color: var(--st); }

/* ===== المحتوى — فاتح ===== */
main { flex: 1 0 auto; padding-block: clamp(28px, 5vw, 52px); }

.page-head { margin-bottom: clamp(22px, 4vw, 36px); }
.kick {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px;
  letter-spacing: 2px; font-weight: 600; color: var(--bronze);
  text-transform: uppercase; margin-bottom: 12px;
}
.page-head h1 {
  font-weight: 700; font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -.6px; line-height: 1.1; color: var(--on-light);
}
.page-head h1 .accent { color: var(--bronze); }
.page-head .lead { color: var(--muted-light); font-size: 15.5px; margin-top: 10px; max-width: 60ch; }
/* OR-70: إجراءات الترويسة (طلب مشروع جديد + تلميح المعلّقة) */
.head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.head-actions .pending-hint { font-size: 13.5px; color: var(--bronze); font-weight: 600; text-decoration: none; }
.head-actions .pending-hint:hover { color: var(--bronze-hi); }

/* ===== شبكة البطاقات ===== */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

/* ===== بطاقة .tile — فاتحة/بيضاء ===== */
.tile {
  display: flex; flex-direction: column; gap: 13px;
  background: var(--card); border: 1px solid var(--bd-light);
  border-radius: 15px; padding: 26px 24px; color: var(--on-light);
  text-align: start; box-shadow: var(--shadow-card);
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.tile { position: relative; }
.tile:hover {
  border-color: var(--bronze); transform: translateY(-4px);
  box-shadow: var(--shadow-hover); color: var(--on-light);
}

.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.tile-id { display: flex; align-items: flex-start; gap: 11px; }
.tile-id .fico {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(184, 138, 68, .12); color: var(--bronze);
}
.tile-id .fico .icon { width: 19px; height: 19px; }
.tile h3 { font-weight: 600; font-size: 18.5px; letter-spacing: -.3px; line-height: 1.35; }
.tile .pno {
  font-size: 12.5px; color: var(--muted-light);
  font-variant-numeric: tabular-nums; letter-spacing: .5px; margin-top: 3px;
}
.tile .meta-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--muted-light);
}
.tile .meta-row .icon { width: 14px; height: 14px; color: var(--muted-light); }
.tile .sep { color: var(--bd-light); }

/* شريط الإنجاز */
.progress { margin-top: 2px; }
.progress .pl {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--muted-light); margin-bottom: 7px;
}
.progress .pl b { color: var(--bronze); font-weight: 600; font-variant-numeric: tabular-nums; }
.progress .track { height: 7px; border-radius: 100px; background: rgba(27, 27, 27, .07); overflow: hidden; }
.progress .fill {
  height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, var(--bronze), var(--bronze-hi));
  transition: width .6s var(--ease);
}

.tile .open {
  margin-top: auto; padding-top: 6px;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 600; color: var(--bronze);
}
.tile:hover .open { color: var(--bronze-hi); }
.tile .open .icon { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.tile:hover .open .icon { transform: translateX(-3px); }

/* ===== OR-66: رابط البطاقة الممتدّ + إطار المرحلة الحالية + جرس المشروع ===== */
/* h3>a يغطّي البطاقة كلّها (رابط ممتدّ) فيبقى الجرس رابطاً مستقلّاً فوقه (لا تداخل روابط). */
.tile h3 .tile-link { color: inherit; }
.tile h3 .tile-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 15px; }

.tile-stage {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--bd-light); border-radius: 10px;
  background: rgba(184, 138, 68, .06); font-size: 13.5px; color: var(--muted-light);
}
.tile-stage .icon { width: 15px; height: 15px; color: var(--bronze); flex: none; }
.tile-stage b { color: var(--on-light); font-weight: 600; }

.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 6px; }
.tile-foot .open { margin-top: 0; padding-top: 0; }

.bell {
  position: relative; z-index: 2; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--bd-light); background: var(--card); color: var(--muted-light);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.bell:hover { border-color: var(--bronze); color: var(--bronze); }
.bell .icon { width: 18px; height: 18px; }
.bell.is-dim { opacity: .5; }
.bell .bell-badge {
  position: absolute; top: -7px; inset-inline-end: -7px;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 100px; background: var(--bronze); color: var(--ivory);
  font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}

/* ===== شارات الحالة (كبسولة، خلفيات فاتحة بألوان الحالات) ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 100px; flex: none;
  font-size: 12px; font-weight: 600; letter-spacing: .2px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active    { color: var(--ys); background: #E8F3EC; }
.badge.completed { color: var(--re); background: #E8F0F4; }
.badge.paused    { color: var(--be); background: #ECEDF6; }
.badge.cancelled { color: var(--st); background: #F6E9EC; }
.badge.archived  { color: var(--muted-light); background: #ECEBE8; }

/* ===== أزرار ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  padding: 13px 24px; border-radius: 8px; border: 1px solid transparent;
  transition: .25s var(--ease); white-space: nowrap;
}
.btn-primary { background: var(--bronze); color: var(--ivory); }
.btn-primary:hover { background: var(--bronze-hi); color: var(--ivory); }
/* ثانويّ محدّد: حدّ برونزيّ ظاهر بلا تعبئة */
.btn-secondary { background: none; color: var(--bronze); border-color: var(--bronze); }
.btn-secondary:hover { background: rgba(184, 138, 68, .08); color: var(--bronze-hi); border-color: var(--bronze-hi); }
.btn-ghost { background: none; color: var(--on-light); border-color: var(--bd-light); }
.btn-ghost:hover { border-color: var(--bronze); color: var(--bronze); }

/* ===== حقول ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted-light); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--card); color: var(--on-light);
  border: 1px solid var(--bd-light); border-radius: 8px;
  padding: 11px 13px; font-family: inherit; font-size: 14.5px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--bronze); }

/* ===== تنبيهات ===== */
.alert {
  border: 1px solid var(--bd-light); border-radius: 11px;
  padding: 14px 16px; font-size: 14px; margin-bottom: 18px;
  border-inline-start-width: 3px;
}
.alert-error { color: var(--st); border-inline-start-color: var(--st); background: #F6E9EC; }
.alert-info  { color: var(--re); border-inline-start-color: var(--re); background: #E8F0F4; }
.alert-success { color: var(--ys); border-inline-start-color: var(--ys); background: #E8F3EC; }
/* OR-67: الرقم المرجعي للعميل قرب اسمه في ترويسة اللوحة */
.cli-ref { font-size: 13px; color: var(--muted-light); margin-top: 6px; }
.cli-ref span { font-variant-numeric: tabular-nums; letter-spacing: .5px; color: var(--on-light); font-weight: 600; }

/* ===== الحالة الفارغة ===== */
.empty {
  text-align: center; padding: clamp(40px, 8vw, 72px) 24px;
  border: 1px dashed var(--bd-light); border-radius: 16px; background: var(--card);
}
.empty .eico {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(184, 138, 68, .12); color: var(--bronze);
}
.empty .eico .icon { width: 26px; height: 26px; }
.empty h3 { font-weight: 600; font-size: 20px; margin-bottom: 8px; color: var(--on-light); }
.empty p { color: var(--muted-light); font-size: 14.5px; max-width: 44ch; margin-inline: auto; }

/* ===== التذييل — فحميّ داكن ===== */
.p-footer {
  flex: none; background: var(--graphite-2); color: var(--on-dark);
  border-top: 1px solid var(--bd-dark);
  padding-block: 28px; margin-top: 48px;
}
.p-footer .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.p-footer .copy { color: var(--muted-dark); font-size: 13px; }
.p-footer .copy b { color: var(--on-dark); font-weight: 600; }

/* ===== التجاوب ===== */
@media (max-width: 620px) {
  .wrap { padding-inline: 18px; }
  .p-header .bar { padding-block: 12px; }
  .p-nav { gap: 2px; }
  .p-nav .nav-link { padding: 7px 11px; font-size: 13.5px; }
  .p-logout button { padding: 7px 11px; }
  .grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   شاشات الدخول والخدمة (OR-61) — بطاقة موسّطة بالمظهر الفاتح
   ========================================================================== */

/* منطقة موسّطة عموديًا وأفقيًا لبطاقة المصادقة */
.auth {
  flex: 1 0 auto;
  display: flex; align-items: center; justify-content: center;
  padding-block: clamp(32px, 7vw, 64px);
}

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--bd-light);
  border-radius: 16px; box-shadow: var(--shadow-card);
  padding: clamp(26px, 5vw, 38px);
}
.auth-card.wide { max-width: 540px; }

/* رأس البطاقة: أيقونة + عنوان + وصف */
.ac-head { text-align: center; margin-bottom: 24px; }
.ac-icon {
  width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(184, 138, 68, .12); color: var(--bronze);
}
.ac-icon .icon { width: 26px; height: 26px; }
.ac-head h1 { font-weight: 700; font-size: 23px; letter-spacing: -.4px; color: var(--on-light); }
.ac-head p { color: var(--muted-light); font-size: 14.5px; margin-top: 8px; line-height: 1.6; }

/* الحقول مع أيقونة أمامية */
.input-ico { position: relative; }
.input-ico .icon {
  position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted-light); pointer-events: none;
}
.input-ico input { padding-inline-start: 40px; }
.input-ico input:focus ~ .icon { color: var(--bronze); }

.btn-block { width: 100%; }

/* روابط أسفل البطاقة */
.auth-links {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--bd-light);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  font-size: 14px;
}
.auth-links a {
  display: inline-flex; align-items: center; gap: 7px; color: var(--bronze);
  font-weight: 500;
}
.auth-links a:hover { color: var(--bronze-hi); }
.auth-links a .icon { width: 15px; height: 15px; }

/* حالة نجاح داخل البطاقة (مثلاً: أُرسل رابط، تم التحويل) */
.ac-success { text-align: center; }
.ac-success .scheck {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #E8F3EC; color: var(--ys);
}
.ac-success .scheck .icon { width: 28px; height: 28px; }
.ac-success p { color: var(--muted-light); font-size: 14.5px; line-height: 1.7; }

/* صفّ التنبيه مع أيقونة */
.alert { display: flex; align-items: flex-start; gap: 9px; }
.alert .icon { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* صفحة 404 / حالة مركزية عامة */
.state {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center;
  padding-block: clamp(40px, 9vw, 90px); text-align: center;
}
.state .inner { max-width: 460px; }
.state .scode {
  font-weight: 700; font-size: clamp(56px, 12vw, 88px); line-height: 1;
  color: var(--bronze); letter-spacing: -2px;
}
.state h1 { font-weight: 700; font-size: 24px; margin-top: 6px; color: var(--on-light); }
.state p { color: var(--muted-light); font-size: 15px; margin-top: 10px; }
.state .actions { margin-top: 26px; display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ===== صفحات الدفع ===== */
.pay {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center;
  padding-block: clamp(32px, 7vw, 64px);
}
.pay-card {
  width: 100%; max-width: 480px; text-align: center;
  background: var(--card); border: 1px solid var(--bd-light);
  border-radius: 16px; box-shadow: var(--shadow-card);
  padding: clamp(28px, 5vw, 40px);
}
.pay-ic {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 18px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pay-ic .icon { width: 30px; height: 30px; }
.pay-ic.is-paid    { background: #E8F3EC; color: var(--ys); }
.pay-ic.is-failed  { background: #F6E9EC; color: var(--st); }
.pay-ic.is-pending { background: #E8F0F4; color: var(--re); }
.pay-card h1 { font-weight: 700; font-size: 23px; letter-spacing: -.4px; }
.pay-card h1.is-paid { color: var(--ys); }
.pay-card h1.is-failed { color: var(--st); }
.pay-card h1.is-pending { color: var(--re); }
.pay-card .pmsg { color: var(--muted-light); font-size: 15px; margin-top: 10px; line-height: 1.7; }
.pay-card .pamount {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--bd-light);
  font-size: 14px; color: var(--muted-light);
}
.pay-card .pamount strong { color: var(--on-light); font-weight: 700; }
.pay-card .pactions { margin-top: 24px; display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* spinner لطيف لصفحة التحويل (CSS فقط) */
.pay-ic.is-redirect { background: rgba(184, 138, 68, .12); color: var(--bronze); }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid rgba(184, 138, 68, .25); border-top-color: var(--bronze);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   شاشات المشروع والكيانات (OR-62)
   ========================================================================== */

.muted { color: var(--muted-light); }

/* رابط رجوع علويّ */
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500; color: var(--bronze); margin-bottom: 16px;
}
.back-link:hover { color: var(--bronze-hi); }
.back-link .icon { width: 15px; height: 15px; }

/* ===== رأس المشروع/الكيان ===== */
.entity-head {
  background: var(--card); border: 1px solid var(--bd-light);
  border-radius: 16px; box-shadow: var(--shadow-card);
  padding: clamp(22px, 4vw, 30px); margin-bottom: 22px;
}
.entity-head .eh-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.entity-head .eh-title { display: flex; align-items: flex-start; gap: 13px; }
.entity-head .eh-ico {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(184, 138, 68, .12); color: var(--bronze);
}
.entity-head .eh-ico .icon { width: 22px; height: 22px; }
.entity-head h1 { font-weight: 700; font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -.5px; line-height: 1.2; }
.entity-head .eh-ref {
  font-size: 13px; color: var(--muted-light); margin-top: 4px;
  font-variant-numeric: tabular-nums; letter-spacing: .4px;
}
.entity-head .eh-actions { display: flex; align-items: center; gap: 12px; }
.entity-head .eh-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; color: var(--muted-light); }
.entity-head .eh-meta b { color: var(--on-light); font-weight: 600; }
.entity-head .progress { margin-top: 18px; }

/* ===== بطاقة قسم ===== */
.section-card {
  background: var(--card); border: 1px solid var(--bd-light);
  border-radius: 15px; box-shadow: var(--shadow-card);
  padding: clamp(18px, 3vw, 24px); margin-bottom: 18px;
}
.sec-title {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -.3px; color: var(--on-light);
  margin-bottom: 16px;
}
.sec-title .sico {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(184, 138, 68, .10); color: var(--bronze);
}
.sec-title .sico .icon { width: 17px; height: 17px; }
.sec-title .count {
  margin-inline-start: auto; font-size: 12.5px; font-weight: 600;
  color: var(--muted-light); background: rgba(27,27,27,.05);
  padding: 2px 9px; border-radius: 100px;
}
.sec-sub { font-weight: 600; font-size: 14.5px; color: var(--on-light); margin: 14px 0 10px; }

.empty-row { color: var(--muted-light); font-size: 14px; padding: 6px 0; }

/* ===== قوائم العناصر ===== */
.item-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  border: 1px solid var(--bd-light); border-radius: 11px; padding: 13px 15px;
  background: var(--ivory); transition: border-color .25s var(--ease);
}
.item:hover { border-color: rgba(184, 138, 68, .4); }
.item .it-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.item .it-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.item .it-main .icon { width: 16px; height: 16px; color: var(--muted-light); flex: none; }
.item .it-title { font-weight: 600; font-size: 14.5px; color: var(--on-light); }
.item a.it-title:hover { color: var(--bronze); }
.item .it-ref { font-size: 12px; color: var(--muted-light); font-variant-numeric: tabular-nums; }
.item .it-sub { font-size: 12.5px; color: var(--muted-light); margin-top: 5px; }
.item .it-meta { font-size: 12px; color: var(--muted-light); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item .it-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item .thumb { margin-top: 10px; }
.item .thumb img { max-width: 240px; max-height: 180px; border: 1px solid var(--bd-light); border-radius: 8px; display: block; }

/* شارات حالة صغيرة بألوان الحالات (للحالات المتنوّعة في الكيانات) */
.badge.s-info    { color: var(--re); background: #E8F0F4; }
.badge.s-ok      { color: var(--ys); background: #E8F3EC; }
.badge.s-warn    { color: var(--bronze); background: rgba(184,138,68,.14); }
.badge.s-danger  { color: var(--st); background: #F6E9EC; }
.badge.s-muted   { color: var(--muted-light); background: #ECEBE8; }

/* ===== روابط/أزرار صغيرة ===== */
.link-act {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--bronze);
}
.link-act:hover { color: var(--bronze-hi); }
.link-act .icon { width: 14px; height: 14px; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; border-radius: 7px; }
.btn-danger {
  background: none; color: var(--st); border-color: rgba(194,83,107,.35);
  font-family: inherit; cursor: pointer;
}
.btn-danger:hover { background: #F6E9EC; border-color: var(--st); color: var(--st); }
.btn-xs {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  padding: 6px 12px; border-radius: 7px; border: 1px solid var(--bd-light);
  background: none; color: var(--muted-light); transition: .2s var(--ease);
}
.btn-xs:hover { border-color: var(--bronze); color: var(--bronze); }
.btn-xs.danger { color: var(--st); }
.btn-xs.danger:hover { border-color: var(--st); background: #F6E9EC; }
.inline-form { display: inline-flex; }

/* ===== نماذج داخل البطاقات ===== */
.card-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--bd-light); }
.card-form .field:last-of-type { margin-bottom: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } }
/* حقل رفع الملفّ + إصلاح زرّ «استعراض» البدائيّ ليطابق النظام */
input[type="file"] { font-family: inherit; font-size: 13.5px; color: var(--muted-light); max-width: 100%; }
input[type="file"]::file-selector-button {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--bronze); background: none; border: 1px solid var(--bronze);
  border-radius: 7px; padding: 8px 16px; margin-inline-end: 12px;
  transition: .2s var(--ease);
}
input[type="file"]::file-selector-button:hover { background: rgba(184, 138, 68, .08); border-color: var(--bronze-hi); color: var(--bronze-hi); }

/* ===== جدول البنود (الفاتورة) ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  text-align: start; color: var(--muted-light); font-weight: 600; font-size: 12.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--bd-light);
}
.data-table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--bd-light); }
.data-table .num { text-align: end; font-variant-numeric: tabular-nums; }
.data-table .center { text-align: center; }
.totals { margin-top: 16px; margin-inline-start: auto; max-width: 320px; }
.totals .t-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals .t-row span:first-child { color: var(--muted-light); }
.totals .t-row .v { font-variant-numeric: tabular-nums; }
.totals .t-grand { border-top: 2px solid var(--bd-light); margin-top: 4px; padding-top: 10px; font-weight: 700; font-size: 16px; }
.totals .t-due { font-weight: 700; }
.totals .t-due .v { color: var(--bronze); }

/* ===== صندوق الإقرار الواعي + القرار ===== */
.consent {
  background: var(--ivory); border: 1px solid var(--bd-light);
  border-inline-start: 3px solid var(--bronze); border-radius: 10px;
  padding: 13px 15px; font-size: 14px; color: var(--on-light); line-height: 1.7;
  margin-bottom: 14px;
}
.decision-note {
  display: flex; align-items: flex-start; gap: 9px;
  background: #E8F3EC; border-radius: 10px; padding: 13px 15px;
  font-size: 14px; color: var(--on-light); margin: 14px 0;
}
.decision-note .icon { width: 17px; height: 17px; color: var(--ys); flex: none; margin-top: 1px; }
.decision-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

/* محتوى مُهرّب مسبقًا (العقد) */
.rich {
  border: 1px solid var(--bd-light); border-radius: 12px; padding: 20px;
  line-height: 1.9; background: var(--card); font-size: 15px;
}
.rich-pre { white-space: pre-wrap; }

/* ===== خيط المحادثة/التذاكر ===== */
.thread { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--bd-light); border-radius: 12px; padding: 12px 15px; background: var(--ivory); max-width: 86%; }
.msg.from-admin { align-self: flex-start; background: var(--ivory); border-color: var(--bd-light); }
.msg.from-you { align-self: flex-end; background: rgba(184,138,68,.07); border-color: rgba(184,138,68,.22); }
.msg .who { font-size: 12px; color: var(--muted-light); margin-bottom: 5px; display: flex; align-items: center; gap: 7px; }
.msg .who b { color: var(--on-light); font-weight: 600; }
.msg .text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.65; }

/* ===== شبكة بطاقات الملخّص (hub) ===== */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.hub-card { border: 1px solid var(--bd-light); border-radius: 11px; padding: 14px; background: var(--ivory); }
.hub-card .hc-title { font-size: 12px; color: var(--muted-light); margin-bottom: 6px; }
.hub-card .hc-value { font-size: 19px; font-weight: 700; color: var(--on-light); }
.hub-card .hc-sub { font-size: 12px; color: var(--muted-light); margin-top: 2px; }
.hub-card .hc-na { font-size: 14px; color: var(--muted-light); }
.hub-card .hc-unread { font-size: 12px; color: var(--st); font-weight: 600; margin-top: 4px; }
.hub-card .hc-link { font-size: 12.5px; margin-top: 6px; }

/* قائمة إشعارات */
.notif-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-size: 14px; }
.notif-filters .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 100px;
  border: 1px solid var(--bd-light); color: var(--muted-light); font-weight: 500;
}
.notif-filters .chip:hover { border-color: var(--bronze); color: var(--bronze); }
.notif-filters .chip.on { background: var(--graphite); color: var(--on-dark); border-color: var(--graphite); }
.notif { display: flex; align-items: flex-start; gap: 12px; }
.notif.is-unread { font-weight: 600; }
.notif.is-read { opacity: .62; }
.notif .n-type {
  font-size: 11px; font-weight: 600; color: var(--bronze); background: rgba(184,138,68,.12);
  padding: 3px 9px; border-radius: 100px; flex: none; margin-top: 1px;
}
.notif .n-body { font-weight: 400; font-size: 13px; color: var(--muted-light); margin-top: 3px; }
.notif .n-time { font-size: 12px; color: var(--muted-light); }

/* ============================================================================
   تبويبات صفحة المشروع (OR-63)
   ========================================================================== */

/* بلا JS: الشريط مخفيّ، وكل اللوحات ظاهرة مكدّسة (تدهور لطيف). */
.proj-tabs .tab-nav { display: none; }
.proj-tabs.js-tabs .tab-nav { display: flex; }
.proj-tabs.js-tabs .tab-panel { display: none; }
.proj-tabs.js-tabs .tab-panel.is-active { display: block; }

.tab-nav {
  gap: 4px; flex-wrap: wrap; margin-bottom: 20px;
  border-bottom: 1px solid var(--bd-light); padding-bottom: 2px;
}
.tab-nav .tab {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  color: var(--muted-light); background: none; border: none;
  padding: 11px 15px; border-bottom: 2.5px solid transparent;
  margin-bottom: -2px; transition: color .2s var(--ease), border-color .2s var(--ease);
}
.tab-nav .tab .icon { width: 16px; height: 16px; }
.tab-nav .tab:hover { color: var(--on-light); }
.tab-nav .tab.is-active { color: var(--bronze); border-bottom-color: var(--bronze); font-weight: 600; }
.tab-nav .tab .tcount {
  font-size: 11.5px; font-weight: 600; color: var(--muted-light);
  background: rgba(27,27,27,.05); padding: 1px 7px; border-radius: 100px;
}
.tab-nav .tab.is-active .tcount { color: var(--bronze); background: rgba(184,138,68,.12); }

/* تبويبات جانبية على الشاشات الواسعة */
@media (min-width: 1024px) {
  .proj-tabs.js-tabs { display: grid; grid-template-columns: 232px 1fr; gap: 26px; align-items: start; }
  .proj-tabs.js-tabs .tab-nav {
    flex-direction: column; gap: 2px; border-bottom: none; padding-bottom: 0;
    position: sticky; top: 86px; margin-bottom: 0;
  }
  .proj-tabs.js-tabs .tab-nav .tab {
    justify-content: flex-start; border-bottom: none; margin-bottom: 0;
    border-radius: 9px; padding: 11px 14px; width: 100%;
    border-inline-start: 2.5px solid transparent;
  }
  .proj-tabs.js-tabs .tab-nav .tab .tcount { margin-inline-start: auto; }
  .proj-tabs.js-tabs .tab-nav .tab.is-active {
    background: rgba(184,138,68,.08); border-bottom-color: transparent;
    border-inline-start-color: var(--bronze);
  }
  .proj-tabs.js-tabs .tab-panels { min-width: 0; }
}

/* تجاوب: شريط أفقيّ قابل للتمرير على الجوال */
@media (max-width: 1023px) {
  .proj-tabs.js-tabs .tab-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .proj-tabs.js-tabs .tab-nav .tab { white-space: nowrap; flex: none; }
}

/* تخطيط مزدوج لقسم الملفّات/الروابط */
.split-2 { display: grid; grid-template-columns: 1fr; gap: 0; }

/* تمييز صفّ الجدول عند التمرير (تحسين OR-63) */
.data-table tbody tr { transition: background .15s var(--ease); }
.data-table tbody tr:hover { background: rgba(184,138,68,.05); }
.data-table thead th {
  background: var(--ivory); border-bottom: 2px solid var(--bronze);
  position: sticky; top: 0;
}
.data-table tbody tr:nth-child(even) { background: rgba(27,27,27,.018); }
.data-table tbody tr:nth-child(even):hover { background: rgba(184,138,68,.05); }

/* ============================================================================
   وضوح البوابة (OR-64): صفوف قابلة للنقر + سطر شرح التبويب + شبكة الملفّات
   ========================================================================== */

/* صفّ جدول قابل للنقر */
.data-table tr.row-link { cursor: pointer; }
.data-table tr.row-link:focus-visible { outline: 2px solid var(--bronze); outline-offset: -2px; }
.data-table .link-act { white-space: nowrap; }

/* سطر تعريفيّ موجز أعلى كل لوحة تبويب */
.tab-desc {
  display: flex; align-items: flex-start; gap: 9px;
  color: var(--muted-light); font-size: 13.5px; line-height: 1.6;
  margin-bottom: 16px; padding: 12px 15px;
  background: var(--card); border: 1px solid var(--bd-light);
  border-inline-start: 3px solid var(--bronze); border-radius: 10px;
}
.tab-desc .icon { width: 17px; height: 17px; color: var(--bronze); flex: none; margin-top: 1px; }
.tab-desc b { color: var(--on-light); font-weight: 600; }

/* ===== شبكة بطاقات الملفّات ===== */
.file-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.file-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--bd-light); border-radius: 13px; overflow: hidden;
  background: var(--card); transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.file-card:hover { border-color: rgba(184,138,68,.4); box-shadow: var(--shadow-card); }
.file-card .fc-preview {
  height: 130px; display: flex; align-items: center; justify-content: center;
  background: var(--ivory); border-bottom: 1px solid var(--bd-light); overflow: hidden;
}
.file-card .fc-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-card .fc-preview .fc-ic { color: var(--bronze); opacity: .85; }
.file-card .fc-preview .fc-ic .icon { width: 40px; height: 40px; }
.file-card .fc-body { padding: 13px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.file-card .fc-name {
  font-weight: 600; font-size: 14px; color: var(--on-light); line-height: 1.4;
  word-break: break-word; overflow-wrap: anywhere;
}
.file-card .fc-meta { font-size: 11.5px; color: var(--muted-light); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.file-card .fc-actions {
  display: flex; gap: 8px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--bd-light);
}
.file-card .fc-actions .btn { flex: 1; padding: 8px 10px; font-size: 13px; border-radius: 8px; }
.file-card .fc-actions form { flex: 1; display: flex; }
.file-card .fc-actions form .btn { width: 100%; }
.file-card .fc-del { color: var(--st); }
.file-card .fc-del:hover { color: var(--st); border-color: var(--st); background: #F6E9EC; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto; }
  .spinner { animation: none; }
}
