/*
 * رموز نظام تصميم تراحيب.
 *
 * مستخرَجة من ui/C00-catalog.html — والكتالوج هو عقد التصميم: من أراد
 * مكوّنًا جديدًا أضافه فيه أولًا. هذا الملف هو الطبقة التي تستهلكها اللوحة،
 * فتتطابق الشاشة المبنيّة مع الشاشة المصمَّمة بلا نسخ CSS في كل صفحة.
 *
 * فاتح فقط عمدًا (§15.ب): الوضع الداكن يضاعف كلفة كل مكوّن وكل اختبار ولا
 * يطلبه السياق — لكن الرموز معرَّفة بحيث لا يمنع إضافته لاحقًا.
 */

:root {
  --sky-50:#F0F9FF;  --sky-100:#E0F2FE; --sky-200:#BAE6FD; --sky-300:#7DD3FC;
  --sky-400:#38BDF8; --sky-500:#0EA5E9; --sky-600:#0284C7; --sky-700:#0369A1;
  --sky-800:#075985; --sky-900:#0C4A6E;

  --slate-50:#F8FAFC; --slate-100:#F1F5F9; --slate-200:#E2E8F0; --slate-300:#CBD5E1;
  --slate-400:#94A3B8; --slate-500:#64748B; --slate-600:#475569; --slate-700:#334155;
  --slate-800:#1E293B; --slate-900:#0F172A;

  --emerald-50:#ECFDF5; --emerald-100:#D1FAE5; --emerald-500:#10B981;
  --emerald-600:#059669; --emerald-700:#047857;
  --amber-50:#FFFBEB; --amber-100:#FEF3C7; --amber-500:#F59E0B;
  --amber-600:#D97706; --amber-700:#B45309;
  --rose-50:#FFF1F2; --rose-100:#FFE4E6; --rose-500:#F43F5E;
  --rose-600:#E11D48; --rose-700:#BE123C;
  --violet-50:#F5F3FF; --violet-100:#EDE9FE; --violet-500:#8B5CF6; --violet-600:#7C3AED;

  /* الطبقة الدلالية — الشاشات تستعمل هذه لا الألوان الخام */
  --brand:var(--sky-600); --brand-dark:var(--sky-700);
  --brand-soft:var(--sky-50); --brand-ink:#FFFFFF;
  --success:var(--emerald-600); --success-soft:var(--emerald-50); --success-ink:var(--emerald-700);
  --warning:var(--amber-600);   --warning-soft:var(--amber-50);   --warning-ink:var(--amber-700);
  --danger:var(--rose-600);     --danger-soft:var(--rose-50);     --danger-ink:var(--rose-700);
  --info:var(--violet-600);     --info-soft:var(--violet-50);

  --ink:var(--slate-800); --ink-mute:var(--slate-600); --ink-faint:var(--slate-400);
  --surface:#FFFFFF; --surface-sunk:var(--slate-50); --page:var(--slate-100);
  --line:var(--slate-200); --line-strong:var(--slate-300);

  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px;
  --s6:24px; --s8:32px; --s10:40px; --s12:48px;
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:20px; --r-full:999px;
  --sh1:0 1px 3px rgba(15,23,42,.05);
  --sh2:0 4px 14px rgba(15,23,42,.07);
  --sh3:0 12px 32px rgba(15,23,42,.12);
  --fs-xs:12px; --fs-sm:13px; --fs-base:15px; --fs-md:17px;
  --fs-lg:20px; --fs-xl:26px; --fs-2xl:34px;
  --t:.2s cubic-bezier(.4,0,.2,1);
  --nav-w:250px; --top-h:62px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

/* ── الهيكل ─────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.nav {
  width: var(--nav-w); flex-shrink: 0; background: var(--surface);
  border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.nav__brand {
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--line);
}
.nav__logo { font-size: var(--fs-lg); font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.nav__tenant { font-size: var(--fs-xs); color: var(--ink-faint); margin-top: 2px; }
.nav__group { padding: var(--s4) var(--s3) 0; }
.nav__label {
  font-size: var(--fs-xs); color: var(--ink-faint); font-weight: 600;
  padding: 0 var(--s3) var(--s2); letter-spacing: .04em;
}
.nav__item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3); border-radius: var(--r-md);
  color: var(--ink-mute); font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--t), color var(--t); margin-bottom: 2px;
}
.nav__item:hover { background: var(--surface-sunk); color: var(--ink); }
.nav__item.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.nav__item.is-soon { opacity: .45; pointer-events: none; }
.nav__item .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; flex-shrink: 0;
}
.nav__foot {
  margin-top: auto; padding: var(--s4); border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--ink-faint);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--s6); position: sticky; top: 0; z-index: 10;
}
.top__title { font-size: var(--fs-md); font-weight: 700; }
.top__meta { font-size: var(--fs-xs); color: var(--ink-faint); }

.content { padding: var(--s6); max-width: 1180px; width: 100%; }

/* ── المكوّنات ──────────────────────────────────────────── */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh1);
}
.card__head {
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
}
.card__title { font-weight: 700; font-size: var(--fs-base); }
.card__body { padding: var(--s5); }

.grid { display: grid; gap: var(--s4); }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.kpi { background: var(--surface); border: 1px solid var(--line);
       border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--sh1); }
.kpi__label { font-size: var(--fs-xs); color: var(--ink-faint); font-weight: 600; }
.kpi__value { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.2; margin-top: var(--s1); letter-spacing: -.02em; }
.kpi__note { font-size: var(--fs-xs); color: var(--ink-mute); margin-top: var(--s1); }

.badge {
  display: inline-flex; align-items: center; gap: var(--s1);
  padding: 2px var(--s3); border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.9;
}
.badge--ok    { background: var(--success-soft); color: var(--success-ink); }
.badge--warn  { background: var(--warning-soft); color: var(--warning-ink); }
.badge--bad   { background: var(--danger-soft);  color: var(--danger-ink); }
.badge--brand { background: var(--brand-soft);   color: var(--brand-dark); }
.badge--mute  { background: var(--surface-sunk); color: var(--ink-mute); }

.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: var(--s2) var(--s4); border-radius: var(--r-md);
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; transition: all var(--t);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--brand-ink); }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; min-width: 720px; }
table.t th, table.t td {
  padding: var(--s3) var(--s4); text-align: start;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.t th {
  background: var(--surface-sunk); font-size: var(--fs-xs);
  color: var(--ink-faint); font-weight: 700; position: sticky; top: 0;
}
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--surface-sunk); }

.flash { padding: var(--s3) var(--s4); border-radius: var(--r-md);
         margin-bottom: var(--s4); font-size: var(--fs-sm); font-weight: 500; }
.flash--ok  { background: var(--success-soft); color: var(--success-ink); border: 1px solid var(--emerald-100); }
.flash--bad { background: var(--danger-soft);  color: var(--danger-ink);  border: 1px solid var(--rose-100); }

.mono {
  font-family: ui-monospace, Menlo, monospace; font-size: var(--fs-xs);
  background: var(--surface-sunk); padding: 1px var(--s2);
  border-radius: var(--r-sm); direction: ltr; display: inline-block;
}
.muted { color: var(--ink-mute); font-size: var(--fs-sm); }
.faint { color: var(--ink-faint); font-size: var(--fs-xs); }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s2) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm);
}
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { color: var(--success); font-weight: 800; flex-shrink: 0; }
.checklist .pend { color: var(--ink-faint); font-weight: 800; flex-shrink: 0; }

/* ── الجوال: الشريط الجانبي ينقلب إلى شريط علوي ─────────── */

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .nav { width: 100%; height: auto; position: static; flex-direction: row;
         align-items: center; gap: var(--s3); overflow-x: auto;
         border-inline-start: 0; border-bottom: 1px solid var(--line); padding: var(--s3); }
  .nav__brand { border-bottom: 0; padding: 0 var(--s3); flex-shrink: 0; }
  .nav__group { display: flex; gap: var(--s2); padding: 0; }
  .nav__label, .nav__foot { display: none; }
  .nav__item { white-space: nowrap; margin-bottom: 0; }
  .content { padding: var(--s4); }
  .top { padding: 0 var(--s4); }
}
