/* ===========================================================================
   AVENOR CX — نظام التصميم، مستخرج من هوية التسويق المعتمدة (CorBit/المدار)
   البنفسجي العميق للسطح والتنقل · تدرّج (بنفسجي ← وردي ← برتقالي) للعلامة
   بطاقات بيضاء بزوايا واسعة وظل ناعم على خلفية بنفسجية فاتحة · خط Tajawal
   =========================================================================== */

/* ---------- الخط (محلي — لا اتصال خارجي) ---------- */
@font-face { font-family: Tajawal; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/tajawal-1.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Tajawal; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/tajawal-2.woff2) format("woff2"); }
@font-face { font-family: Tajawal; font-weight: 500; font-display: swap;
  src: url(/vendor/fonts/tajawal-3.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Tajawal; font-weight: 500; font-display: swap;
  src: url(/vendor/fonts/tajawal-4.woff2) format("woff2"); }
@font-face { font-family: Tajawal; font-weight: 700; font-display: swap;
  src: url(/vendor/fonts/tajawal-5.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Tajawal; font-weight: 700; font-display: swap;
  src: url(/vendor/fonts/tajawal-6.woff2) format("woff2"); }
@font-face { font-family: Tajawal; font-weight: 800; font-display: swap;
  src: url(/vendor/fonts/tajawal-7.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Tajawal; font-weight: 800; font-display: swap;
  src: url(/vendor/fonts/tajawal-8.woff2) format("woff2"); }

:root {
  /* الهوية — تُستبدل لكل عميل عبر الوايت ليبل (--brand-primary/--brand-secondary).
   * مستخرجة من corbit.sa بقراءة الأنماط المحسوبة لا بالعين: العنّابي #7A1E2E
   * هو لون العلامة الفعلي (الأزرار والشريط السفلي)، والمحايدات من عائلة slate. */
  --brand-primary: #7A1E2E;   /* العنّابي الأساسي */
  --brand-secondary: #A12D40; /* عنّابي أفتح — التدرّج وحالات التحويم */
  --brand-accent: #D97706;    /* الذهبي المساعد */
  --brand-gradient: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary), var(--brand-accent));
  /* خلفية ناعمة بلون الهوية — الموقع نفسه يستخدم العنّابي بشفافية 5% */
  --brand-tint: #FBF3F4;

  --nav: #4A121D;             /* سطح التنقل — عنّابي داكن */
  --nav-soft: #5F1723;
  --ink: #0F172A;             /* نص العناوين */
  --ink-soft: #475569;        /* نص ثانوي */
  --bg: #F8FAFC;              /* خلفية الصفحة */
  --line: #E5E7EB;
  --ok: #16A34A;
  --warn: #D97706;
  --err: #DC2626;
  --radius: 16px;
  --shadow: 0 2px 14px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }

body {
  font-family: Tajawal, "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.2px; }

.dev-banner {
  background: linear-gradient(90deg, #FFF7ED, #FDF2F8);
  border-bottom: 1px solid #F5E4D7;
  padding: 7px 16px;
  font-size: 12.5px;
  color: #92400E;
  text-align: center;
}

/* ---------- الشريط العلوي ---------- */
header.topbar {
  background: var(--nav);
  color: #fff;
  padding: 12px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: relative;
}
/* خيط التدرّج: توقيع العلامة في كل صفحة */
header.topbar::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px;
  background: var(--brand-gradient);
}
header.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
header.topbar img.logo { height: 30px; }

.container { max-width: 1180px; margin: 22px auto; padding: 0 18px; }

/* ---------- البطاقات ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px; font-size: 16px;
  border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
.card h3 { margin: 16px 0 8px; font-size: 14px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- بطاقات المؤشرات (نمط لوحة التسويق) ---------- */
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
  background: var(--brand-gradient);
}
.stat .n { font-size: 26px; font-weight: 800; line-height: 1.25; }
.stat .l { font-size: 12.5px; color: var(--ink-soft); }
.stat .delta { font-size: 12px; font-weight: 700; }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--err); }

/* ---------- الجداول ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: #F3F0FC; text-align: right; padding: 9px 11px;
  border-bottom: 1px solid var(--line); color: #4C3D8F; font-weight: 700;
}
td { padding: 8px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #FAF9FE; }

/* ---------- الحقول ---------- */
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #D8D4EC;
  border-radius: 10px;
  font: inherit;
  margin: 4px 0 12px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
}
label { font-size: 13px; color: #414761; font-weight: 500; }

/* ---------- الأزرار ---------- */
button {
  padding: 9px 16px;
  border: 1px solid #D8D4EC;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
button:hover { background: #F6F3FF; border-color: #C9C1EC; }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--brand-primary); color: #fff; border-color: transparent;
  box-shadow: 0 3px 10px rgba(109, 40, 217, .25);
}
button.primary:hover { background: #5B21B6; }
button.brand {
  background: var(--brand-gradient); color: #fff; border-color: transparent; font-weight: 700;
  box-shadow: 0 4px 14px rgba(236, 72, 153, .28);
}
button.small { padding: 4px 11px; font-size: 12px; border-radius: 8px; }
button.danger { border-color: #F1BDBD; color: var(--err); }
button.danger:hover { background: #FEF2F2; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- التبويبات ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border-radius: 10px; background: #fff; }
.tabs button.active {
  background: var(--brand-primary); color: #fff; border-color: transparent;
  box-shadow: 0 3px 10px rgba(109, 40, 217, .22);
}

/* ---------- الشارات ---------- */
.badge {
  display: inline-block;
  padding: 2px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #F1EEFB;
  border: 1px solid #DDD6F3;
  color: #4C3D8F;
  white-space: nowrap;
}
.badge.ok { background: #E8F7EE; border-color: #B7E4C7; color: #15803D; }
.badge.warn { background: #FEF6E7; border-color: #F5D9A0; color: #92400E; }
.badge.err { background: #FDECEC; border-color: #F3C0C0; color: #B91C1C; }

.muted { color: var(--ink-soft); font-size: 12.5px; }

.msg { padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: 13px; display: none; }
.msg.ok { background: #E8F7EE; border: 1px solid #B7E4C7; color: #15803D; display: block; }
.msg.err { background: #FDECEC; border: 1px solid #F3C0C0; color: #B91C1C; display: block; }

pre.mini {
  background: #FAF9FE;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.timeline { list-style: none; padding: 0; margin: 8px 0; }
.timeline li {
  border-right: 2px solid #DDD6F3; padding: 3px 12px 10px; margin-right: 6px; font-size: 12.5px;
}
.timeline li:last-child { border-right-color: var(--brand-primary); }

/* ---------- تنقل بالأيقونات ---------- */
.shell aside .nav-group {
  font-size: 11px; letter-spacing: .4px; color: #8C86B8;
  padding: 14px 12px 6px; font-weight: 700;
}
.shell aside nav button { display: flex; align-items: center; gap: 10px; }
.shell aside nav button .ico { font-size: 16px; width: 20px; text-align: center; flex: none; }
.shell aside nav button .soon {
  margin-inline-start: auto; font-size: 10px; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; background: rgba(255, 255, 255, .12); color: #E8C79A;
}
.shell aside nav button.active .soon { background: rgba(0, 0, 0, .22); color: #FFE9C7; }

/* شاشة الميزة غير المبنية: تشرح ما ستقدّمه بدل صفحة فارغة */
.soon-card { text-align: center; max-width: 560px; margin: 40px auto; }
.soon-card .soon-ico {
  font-size: 46px; width: 88px; height: 88px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; border-radius: 26px;
  background: linear-gradient(180deg, #F5F1FE, #EDE7FB); border: 1px solid var(--line);
}
.soon-card p { color: var(--ink-soft); line-height: 1.9; }

/* بيانات تجربة بضغطة — بيئة التطوير فقط */
.demo-fill {
  margin-top: 14px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(180deg, #FBF8FF, #F5F1FE); border: 1px dashed #D8CFF5;
}

.hidden { display: none; }
.rowflex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
footer { text-align: center; color: #9AA0B4; font-size: 12px; padding: 22px; }

/* ---------- هيكل اللوحة: تنقل جانبي (RTL) ---------- */
.shell { display: flex; min-height: 100vh; }
.shell aside {
  width: 232px; flex: none; background: var(--nav); color: #C9C4E8;
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.shell aside .brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; color: #fff;
}
.shell aside .brand .mark {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--brand-gradient);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 34%, #000 36%);
          mask: radial-gradient(circle at 50% 50%, transparent 34%, #000 36%);
}
.shell aside .brand b { font-size: 15px; font-weight: 800; }
.shell aside nav button {
  width: 100%; text-align: right; background: transparent; border: none;
  color: #C9C4E8; padding: 10px 12px; border-radius: 10px; font-size: 14px;
}
.shell aside nav button:hover { background: var(--nav-soft); color: #fff; }
.shell aside nav button.active {
  background: var(--brand-primary); color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(109, 40, 217, .35);
}
.shell main { flex: 1; min-width: 0; padding: 22px 26px; }
.shell main > header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.shell main > header h1 { font-size: 20px; margin: 0; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .shell aside { width: auto; flex-direction: row; overflow-x: auto; padding: 10px; align-items: center; }
  .shell aside .brand { padding: 4px 8px; flex: none; }
  .shell aside nav { display: flex; gap: 6px; }
  .shell aside nav button { white-space: nowrap; }
  /* عناوين المجموعات تُخفى أفقياً: تسرق عرضاً ثميناً بلا فائدة تنقّل */
  .shell aside .nav-group { display: none; }
  .shell aside nav button .soon { margin-inline-start: 4px; }
  .shell main { padding: 16px; }
}
