/* =============================================================
   FACILITY VISITORS SYSTEM — DESIGN SYSTEM
   نظام زوار المنشآت — ملف نظام التصميم الموحّد
   -------------------------------------------------------------
   الاستخدام: انسخ هذا الملف كاملاً داخل <style> في كل صفحة،
   أو اربطه: <link rel="stylesheet" href="design-system.css">
   المستند: AI_DESIGN_GUIDE.md
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Readex+Pro:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700;800&display=swap');

/* =============================================================
   1) PALETTES — تُبدَّل عبر <body data-palette="sky">
   كل لوحة تعرّف نفس الـ 14 متغيّراً. لا تضف متغيّرات جديدة.
   ============================================================= */

[data-palette="sky"] {      /* الأزرق السماوي — الافتراضي */
  --bg: #eef5fa; --bg-2: #e0eef7; --bg-3: #cee3f0;
  --ink: #0c2340; --ink-soft: #2f4a6a; --muted: #6b8199;
  --primary: #0369a1; --primary-hover: #025282; --primary-soft: #d3e7f2;
  --accent: #f59e0b; --accent-soft: #fdecc8;
  --line: #b8cfe0; --line-soft: #d3e0ea; --card: #ffffff;
}
[data-palette="olive"] {    /* الأخضر الزيتي */
  --bg: #f6f5ec; --bg-2: #eceadb; --bg-3: #dddcbf;
  --ink: #2a2f14; --ink-soft: #4a5233; --muted: #7a7d62;
  --primary: #556b2f; --primary-hover: #3f5122; --primary-soft: #e1e6d0;
  --accent: #b8860b; --accent-soft: #f0e1b8;
  --line: #c8c6a8; --line-soft: #d8d7be; --card: #ffffff;
}
[data-palette="coral"] {    /* المرجاني */
  --bg: #fdf2f1; --bg-2: #f7e2df; --bg-3: #efccc6;
  --ink: #3f1918; --ink-soft: #6b2e2b; --muted: #8b6763;
  --primary: #c44536; --primary-hover: #9d3528; --primary-soft: #f0d1cc;
  --accent: #1e3a5f; --accent-soft: #ccd6e3;
  --line: #d9bfbb; --line-soft: #e5d1cd; --card: #ffffff;
}
[data-palette="sand"] {     /* الصحراوي */
  --bg: #faf5ec; --bg-2: #f0e7d3; --bg-3: #e2d3b5;
  --ink: #3a2810; --ink-soft: #614a26; --muted: #857a5e;
  --primary: #8b6914; --primary-hover: #6b500d; --primary-soft: #eddfbe;
  --accent: #5c3317; --accent-soft: #e0cfc0;
  --line: #d2c2a0; --line-soft: #e0d4b8; --card: #ffffff;
}
[data-palette="slate"] {    /* الرمادي الفحمي */
  --bg: #f4f5f7; --bg-2: #e6e8ed; --bg-3: #d4d7e0;
  --ink: #0f172a; --ink-soft: #334155; --muted: #64748b;
  --primary: #334155; --primary-hover: #1f2937; --primary-soft: #dde1e8;
  --accent: #0d9488; --accent-soft: #c8e6e2;
  --line: #cdd2dc; --line-soft: #dde1e8; --card: #ffffff;
}
[data-palette="mint"] {     /* النعناعي */
  --bg: #edfdf4; --bg-2: #d8f3e4; --bg-3: #bbe3ce;
  --ink: #0c3a2e; --ink-soft: #2b5a4c; --muted: #6a8478;
  --primary: #047857; --primary-hover: #035e45; --primary-soft: #c5e5d7;
  --accent: #7c3aed; --accent-soft: #e0d2fa;
  --line: #b8d4c6; --line-soft: #cce0d5; --card: #ffffff;
}
[data-palette="amber"] {    /* العنبري الدافئ */
  --bg: #fefce8; --bg-2: #faf5cc; --bg-3: #efe3a6;
  --ink: #3d2e0a; --ink-soft: #63481c; --muted: #8b7742;
  --primary: #a16207; --primary-hover: #7d4b05; --primary-soft: #f3e3b8;
  --accent: #9a3412; --accent-soft: #f0cec3;
  --line: #d9cc9a; --line-soft: #e5dcb4; --card: #ffffff;
}
[data-palette="navy"] {     /* الكحلي العميق */
  --bg: #eef2f7; --bg-2: #dde5ef; --bg-3: #c5d2e3;
  --ink: #0f1e3a; --ink-soft: #2a3b5e; --muted: #657389;
  --primary: #1e3a8a; --primary-hover: #152a6b; --primary-soft: #d5ddee;
  --accent: #c2410c; --accent-soft: #f0d1c3;
  --line: #b9c4d6; --line-soft: #d0d8e3; --card: #ffffff;
}
[data-palette="plum"] {     /* البرقوقي */
  --bg: #faf3fa; --bg-2: #f0e1f0; --bg-3: #e2c8e4;
  --ink: #3a0f3e; --ink-soft: #5c2b63; --muted: #8d6d91;
  --primary: #86198f; --primary-hover: #6b1471; --primary-soft: #efd6f0;
  --accent: #ca8a04; --accent-soft: #f3e3b8;
  --line: #d5bcd8; --line-soft: #e3cee5; --card: #ffffff;
}
[data-palette="forest"] {   /* الأخضر الغابوي */
  --bg: #f0f9f4; --bg-2: #dcefe3; --bg-3: #bfdcc9;
  --ink: #0c2e1b; --ink-soft: #2b5236; --muted: #6b7d73;
  --primary: #14532d; --primary-hover: #0d3f20; --primary-soft: #c8ded1;
  --accent: #b45309; --accent-soft: #f0dcc0;
  --line: #b9d1bf; --line-soft: #cfdfd1; --card: #ffffff;
}
[data-palette="sunset"] {   /* الغروب البرتقالي */
  --bg: #fff6ee; --bg-2: #fae6d2; --bg-3: #f0cfac;
  --ink: #3a1a0a; --ink-soft: #6b3519; --muted: #8f6d56;
  --primary: #c2410c; --primary-hover: #9c3208; --primary-soft: #f5d3bf;
  --accent: #1e3a8a; --accent-soft: #ccd5ec;
  --line: #e6c8ae; --line-soft: #ebd7c0; --card: #ffffff;
}
/* لوحات إضافية اختيارية */
[data-palette="purple"] {
  --bg: #f5f0f8; --bg-2: #ebe1f0; --bg-3: #ddcde5;
  --ink: #2e1065; --ink-soft: #4c2e80; --muted: #7b6c90;
  --primary: #5b21b6; --primary-hover: #441690; --primary-soft: #e5d9f0;
  --accent: #d4a373; --accent-soft: #efe0cc;
  --line: #c9bcd1; --line-soft: #ddd1e2; --card: #ffffff;
}
[data-palette="teal"] {
  --bg: #eff8f6; --bg-2: #dcf0ec; --bg-3: #c3e2da;
  --ink: #134e4a; --ink-soft: #2f6e68; --muted: #667c7a;
  --primary: #0f766e; --primary-hover: #0a5a54; --primary-soft: #cfe6e1;
  --accent: #ea580c; --accent-soft: #fddcc7;
  --line: #b6ccc8; --line-soft: #cedbd8; --card: #ffffff;
}
[data-palette="burgundy"] {
  --bg: #fdf4f0; --bg-2: #f5e5de; --bg-3: #eacfc4;
  --ink: #3f0f0f; --ink-soft: #6b2e2e; --muted: #8b6b67;
  --primary: #7c2d2d; --primary-hover: #601f1f; --primary-soft: #ecd4d4;
  --accent: #b8860b; --accent-soft: #f0e2b8;
  --line: #d4bfb7; --line-soft: #e4d3cc; --card: #ffffff;
}

/* =============================================================
   2) SEMANTIC TOKENS — ثابتة عبر كل اللوحات (حالات فقط)
   ============================================================= */
:root {
  --ok:      #10b981;  --ok-ink:   #047857;  --ok-bg:   rgba(16,185,129,0.12);
  --warn:    #f59e0b;  --warn-ink: #b45309;  --warn-bg: rgba(245,158,11,0.12);
  --danger:  #dc2626;  --danger-ink:#b91c1c; --danger-bg:rgba(220,38,38,0.10);
  --info:    #0e7490;  --info-ink: #0e7490;  --info-bg: rgba(14,116,144,0.10);
  --neutral: #9ca3af;

  --font-body:    'IBM Plex Sans Arabic', sans-serif;
  --font-display: 'Readex Pro', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-2xl: 20px; --r-pill: 999px;

  --sh-card:   0 1px 3px rgba(15,23,42,0.03);
  --sh-pop:    0 20px 50px rgba(0,0,0,0.15);
  --sh-modal:  0 25px 70px rgba(0,0,0,0.30);
  --sh-panel:  30px 0 60px rgba(0,0,0,0.15);
  --sh-float:  0 15px 40px rgba(0,0,0,0.25);

  --t-fast: 0.15s ease;
  --t-base: 0.22s ease;
  --t-panel: 0.35s cubic-bezier(0.32, 0.72, 0, 1);

  --sidebar-w: 278px;
  --content-max: 1400px;
}

/* =============================================================
   3) BASE
   ============================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.35s ease;
}

/* الطبقة الجوّية: تدرّجان ناعمان + حبيبات — تُوضع مرة واحدة على body */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 10%, var(--accent-soft) 0%, transparent 35%),
    radial-gradient(circle at 85% 90%, var(--primary-soft) 0%, transparent 40%);
  opacity: 0.45; transition: all 0.35s ease;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.35; mix-blend-mode: multiply;
}
.app { position: relative; z-index: 1; }

::selection { background: var(--primary-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* الأرقام واللاتيني دائماً LTR داخل نص عربي */
.ltr, .mono { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* =============================================================
   4) APP SHELL — الهيكل الثابت لكل الشاشات بعد تسجيل الدخول
   ============================================================= */
.app-layout { display: flex; min-height: 100vh; background: var(--bg); }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--card);
  border-left: 1px solid var(--line-soft);   /* RTL: الحد على اليسار */
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-header { padding: 18px 18px 16px; border-bottom: 1px solid var(--line-soft); }
.sb-logo-row { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.sb-logo-mark {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--ink); color: var(--card);
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.sb-logo-mark svg { width: 21px; height: 21px; }
.sb-logo-text { flex: 1; min-width: 0; }
.sb-logo-text .facility { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-logo-text .system { font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 500; }

.new-visit-btn {
  width: 100%; padding: 11px 14px;
  background: var(--ink); color: var(--card);
  border: none; border-radius: 11px;
  font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all var(--t-base); box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.new-visit-btn:hover { background: var(--primary); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,0.14); }
.new-visit-btn svg { width: 15px; height: 15px; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; scrollbar-width: thin; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.nav-section { margin-bottom: 18px; }
.nav-section-title {
  font-size: 10.5px; color: var(--muted); font-weight: 700;
  letter-spacing: 0.12em; padding: 0 12px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--ink-soft); cursor: pointer; text-decoration: none;
  font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
  position: relative; transition: all var(--t-fast);
}
.nav-item:hover:not(.active) { background: var(--bg-2); color: var(--ink); }
.nav-item.active {
  background: var(--primary); color: var(--card); font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.nav-item.active::before {          /* شريط accent على الحافة الخارجية */
  content: ''; position: absolute; left: -10px; top: 25%; bottom: 25%;
  width: 4px; background: var(--accent); border-radius: 2px;
}
.nav-item svg.lead { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .chev { margin-right: auto; width: 13px; height: 13px; opacity: 0.55; transition: transform var(--t-base); }
.nav-item.expandable.open .chev { transform: rotate(-90deg); }
.nav-count, .nav-item .badge-count {
  margin-right: auto; background: var(--danger); color: #fff;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--r-pill); min-width: 18px; text-align: center;
}
.nav-submenu { display: none; margin: 2px 0 6px; padding-right: 14px; border-right: 1px dashed var(--line); }
.nav-submenu.open { display: block; }
.nav-subitem {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink-soft); font-size: 12.5px; font-weight: 500;
  transition: all var(--t-fast);
}
.nav-subitem:hover { background: var(--bg-2); color: var(--ink); }
.nav-subitem.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-subitem .sub-ic { width: 15px; height: 15px; display: grid; place-items: center; }
.nav-subitem .sub-ic svg { width: 14px; height: 14px; }

.sidebar-footer { border-top: 1px solid var(--line-soft); padding: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px; cursor: pointer; transition: background var(--t-base); }
.user-card:hover { background: var(--bg-2); }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--card); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-info-text { flex: 1; min-width: 0; }
.user-info-text .uname { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info-text .uemail { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .user-chev { width: 14px; height: 14px; color: var(--muted); }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 39; opacity: 0; visibility: hidden; transition: all var(--t-base);
}
.sidebar-backdrop.open { opacity: 1; visibility: visible; }

/* ---- APP MAIN + HEADER ---- */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
  background: var(--card); border-bottom: 1px solid var(--line-soft);
  padding: 11px 22px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 35;
}
.header-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.header-breadcrumb a { color: var(--muted); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.header-breadcrumb a:hover { color: var(--ink); }
.header-breadcrumb a svg { width: 14px; height: 14px; }
.header-breadcrumb .sep { color: var(--line); font-size: 14px; margin: 0 2px; }
.header-breadcrumb .current { color: var(--ink); font-weight: 700; }

.header-search { flex: 1; max-width: 420px; margin: 0 auto; position: relative; }
.header-search input {
  width: 100%; padding: 9px 38px 9px 52px;
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 9px;
  font-family: inherit; font-size: 13px; color: var(--ink); transition: all var(--t-base);
}
.header-search input:focus { outline: none; border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--primary-soft); }
.header-search input::placeholder { color: var(--muted); }
.header-search .search-ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.header-search .hotkey { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); display: flex; gap: 3px; }
.header-search .hotkey kbd {
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px;
  background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; color: var(--muted); font-weight: 600;
}
.header-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--ink-soft);
  cursor: pointer; display: grid; place-items: center; position: relative; transition: all var(--t-base);
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .nbadge {
  position: absolute; top: 5px; left: 5px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 10px; display: grid; place-items: center; border: 2px solid var(--card);
}

/* ---- CONTENT + PAGE HEAD ---- */
.app-content { flex: 1; padding: 28px 32px 48px; max-width: var(--content-max); width: 100%; margin: 0 auto; }
.page-title-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; margin-bottom: 5px; }
.page-subtitle { font-size: 14px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; }

/* =============================================================
   5) BUTTONS
   ============================================================= */
.btn-add {                     /* الزر الأساسي داخل الصفحات */
  padding: 9px 16px; background: var(--ink); color: var(--card);
  border: none; border-radius: var(--r-md);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all var(--t-base);
}
.btn-add:hover { background: var(--primary); transform: translateY(-1px); }
.btn-add svg { width: 14px; height: 14px; }

.btn-secondary {
  padding: 10px 18px; background: transparent;
  border: 1px solid var(--line); border-radius: var(--r-md);
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink-soft);
  cursor: pointer; transition: all var(--t-base);
}
.btn-secondary:hover { background: var(--bg-2); color: var(--ink); }

.btn-danger {
  padding: 10px 18px; background: var(--danger); color: #fff;
  border: none; border-radius: var(--r-md);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all var(--t-base);
}
.btn-danger:hover { background: var(--danger-ink); }

.btn-primary {                 /* زر كامل العرض — للنماذج المستقلة/الدخول */
  width: 100%; padding: 15px; background: var(--ink); color: var(--bg);
  border: none; border-radius: 12px;
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.25s;
}
.btn-primary:hover { background: var(--primary); transform: translateY(-2px); box-shadow: 0 12px 24px -8px rgba(0,0,0,0.25); }
.btn-primary svg { width: 18px; height: 18px; transition: transform var(--t-base); }

button:disabled, .btn-add:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* =============================================================
   6) CARD
   ============================================================= */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-xl); margin-bottom: 20px; overflow: hidden; }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.card-title-block .title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.card-title-block .title .title-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.card-title-block .title .title-ic svg { width: 16px; height: 16px; }
.card-title-block .subtitle { font-size: 13px; color: var(--muted); padding-right: 40px; }
.card-body { padding: 22px; }

/* =============================================================
   7) KPI / STAT CARDS
   ============================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1024px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  padding: 16px; position: relative; overflow: hidden; cursor: pointer;
  text-decoration: none; color: inherit; display: block; transition: all var(--t-fast);
}
.kpi:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(12,35,64,0.15); }
.kpi.highlight { background: linear-gradient(135deg, var(--primary-soft) 0%, var(--bg-2) 100%); border-color: var(--primary); }
.kpi.urgent { background: linear-gradient(135deg, rgba(245,158,11,0.05) 0%, rgba(245,158,11,0.10) 100%); border-color: rgba(245,158,11,0.25); }
.kpi.urgent::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #f59e0b, #d97706); }
.kpi-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kpi-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.kpi-icon svg { width: 15px; height: 15px; }
.kpi-icon.primary { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.success { background: var(--ok-bg);   color: var(--ok-ink); }
.kpi-icon.warn    { background: var(--warn-bg); color: var(--warn-ink); }
.kpi-icon.info    { background: var(--info-bg); color: var(--info-ink); }
.kpi-val { font-family: var(--font-mono); font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -0.03em; margin-bottom: 8px; }
.kpi-val-unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.kpi-sub { font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: var(--r-pill); font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; }
.kpi-trend.up   { background: var(--ok-bg); color: var(--ok-ink); }
.kpi-trend.down { background: var(--danger-bg); color: var(--danger-ink); }

/* =============================================================
   8) TOOLBAR / FILTERS / CHIPS
   ============================================================= */
.filter-toolbar { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; margin-bottom: 12px; align-items: center; }
@media (max-width: 900px) { .filter-toolbar { grid-template-columns: 1fr 1fr; } .filter-toolbar > *:first-child { grid-column: 1 / -1; } }

.search-box { position: relative; min-width: 240px; }
.search-box svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%; padding: 10px 36px 10px 14px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  font-family: inherit; font-size: 12.5px; color: var(--ink); outline: none; transition: all var(--t-fast);
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.toolbar-btn {
  padding: 10px 14px; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: all var(--t-fast);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; position: relative;
}
.toolbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.toolbar-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.toolbar-btn.primary { background: var(--primary); color: var(--card); border-color: var(--primary); }
.toolbar-btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.toolbar-btn svg { width: 13px; height: 13px; }
.toolbar-btn-count { padding: 1px 7px; border-radius: var(--r-pill); background: var(--primary); color: var(--card); font-family: var(--font-mono); font-size: 10px; font-weight: 700; min-width: 18px; text-align: center; }

.chip {                              /* chip اختيار سريع (تاريخ/حالة) */
  padding: 7px 14px; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--r-pill);
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: all var(--t-fast); display: inline-flex; align-items: center; gap: 5px;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: var(--card); border-color: var(--primary); }
.chip svg { width: 11px; height: 11px; }

.filter-panel { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; display: none; }
.filter-panel.show { display: block; }
.filter-group { margin-bottom: 14px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.filter-group-title { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  padding: 6px 12px; background: var(--bg); border: 1.5px solid var(--line-soft);
  border-radius: var(--r-pill); font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; transition: all var(--t-fast);
  display: inline-flex; align-items: center; gap: 5px;
}
.filter-chip:hover { border-color: var(--primary); }
.filter-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.filter-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color, var(--muted)); }
.filter-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; margin-top: 6px; border-top: 1px dashed var(--line-soft); }

/* =============================================================
   9) DATA TABLE
   ============================================================= */
.table-shell { background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; box-shadow: var(--sh-card); }
.table-head-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.table-head-count { font-size: 12.5px; color: var(--muted); }
.table-head-count strong { color: var(--ink); font-weight: 700; font-family: var(--font-display); }
.table-scroll { overflow-x: auto; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table thead th {
  background: var(--bg); color: var(--muted);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; text-align: right;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; user-select: none;
}
.data-table thead th.sortable { cursor: pointer; }
.data-table thead th.sortable:hover { color: var(--primary); }
.data-table thead th.sorted { color: var(--ink); }
.data-table tbody tr { background: var(--card); transition: background 0.12s; position: relative; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr.is-selected, .data-table tbody tr.is-selected:hover { background: var(--primary-soft); }
.data-table tbody td { padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* خلايا نمطية */
.cell-id { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 3px 9px; background: var(--bg-2); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.cell-person { display: flex; align-items: center; gap: 11px; }
.cell-avatar {
  width: 36px; height: 36px; border-radius: 50%; color: #fff;
  display: grid; place-items: center; font-family: var(--font-display);
  font-size: 12.5px; font-weight: 700; flex-shrink: 0; text-transform: uppercase; position: relative;
}
.cell-avatar::after { content: ''; position: absolute; bottom: -1px; left: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--card); }
.cell-avatar.offline::after   { background: var(--neutral); }
.cell-avatar.suspended::after { background: var(--warn); }
.cell-name { font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-role { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.cell-email, .cell-phone { font-family: var(--font-mono); direction: ltr; text-align: right; display: block; }
.cell-email { font-size: 12px; color: var(--ink); font-weight: 500; }
.cell-phone { font-size: 11px; color: var(--muted); margin-top: 3px; }

.row-menu-btn {
  width: 28px; height: 28px; border-radius: 7px; background: transparent; border: none;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
  opacity: 0; transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.data-table tbody tr:hover .row-menu-btn, .row-menu-btn.is-active { opacity: 1; }
.row-menu-btn:hover { background: var(--bg-2); color: var(--ink); }
.row-menu-btn svg { width: 16px; height: 16px; }

/* Checkbox */
.check {
  appearance: none; width: 16px; height: 16px;
  border: 1.5px solid var(--line); border-radius: 4px; background: var(--card);
  cursor: pointer; position: relative; transition: all var(--t-fast); vertical-align: middle;
}
.check:hover { border-color: var(--primary); }
.check:checked { background: var(--primary); border-color: var(--primary); }
/* Indeterminate is a checkbox state (select-all with a partial pick). A radio
   group with nothing chosen is also :indeterminate in the browser — styling
   that the same as checked paints every plan as if it were selected. */
input[type="checkbox"].check:indeterminate { background: var(--primary); border-color: var(--primary); }
.check:checked::after {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 11px; background-position: center; background-repeat: no-repeat;
}
input[type="radio"].check { border-radius: 50%; }
input[type="radio"].check:checked::after {
  background-image: none; inset: 4px; border-radius: 50%; background: #fff;
}

/* =============================================================
   10) STATUS PILLS + BADGES
   ============================================================= */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; position: relative; }
.status-pill.st-active    { background: var(--ok-bg);     color: var(--ok-ink); }
.status-pill.st-active .dot    { background: var(--ok); }
.status-pill.st-active .dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: rgba(16,185,129,0.35); animation: pulseRing 2s ease-out infinite;
}
.status-pill.st-pending   { background: var(--warn-bg);   color: var(--warn-ink); }
.status-pill.st-pending .dot   { background: var(--warn); }
.status-pill.st-rejected  { background: var(--danger-bg); color: var(--danger-ink); }
.status-pill.st-rejected .dot  { background: var(--danger); }
.status-pill.st-info      { background: var(--info-bg);   color: var(--info-ink); }
.status-pill.st-info .dot      { background: var(--info); }
.status-pill.st-inactive  { background: var(--bg-2);      color: var(--muted); }
.status-pill.st-inactive .dot  { background: var(--neutral); }

@keyframes pulseRing { 0% { transform: scale(0.9); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

.tag {                        /* وسم بسيط (قسم/إدارة) */
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 7px; background: var(--bg-2); border-radius: 5px;
  font-size: 11px; font-weight: 600; color: var(--ink); white-space: nowrap; line-height: 1.4;
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--tag-color, var(--primary)); flex-shrink: 0; }
.tag.more { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.tag.more::before { display: none; }

/* =============================================================
   11) FORMS
   ============================================================= */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row-3 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: end; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .form-row-3 { grid-template-columns: 1fr; align-items: stretch; } }
.form-row > .form-field,
.form-row-3 > .form-field { margin-bottom: 0; }
.form-filter { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-filter > .form-field { margin-bottom: 0; min-width: 0; }
.form-filter .form-field-grow { flex: 1 1 280px; min-width: min(100%, 220px); }
.form-filter .form-field-sm { flex: 0 1 180px; width: 180px; max-width: 100%; }
.form-filter-actions { flex: 0 0 auto; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.form-field label .req { color: var(--accent); margin-right: 3px; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px; background: var(--bg);
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  font-family: inherit; font-size: 13.5px; color: var(--ink); transition: all var(--t-base);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-input.error, .form-select.error { border-color: var(--danger); }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
.field-error { font-size: 11px; color: var(--danger-ink); margin-top: 5px; font-weight: 600; }
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 8px; }

.toggle-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { display: none; }
.toggle-switch .ts-track { position: absolute; inset: 0; background: var(--line); border-radius: var(--r-pill); cursor: pointer; transition: background var(--t-base); }
.toggle-switch .ts-track::after {
  content: ''; position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  background: var(--card); border-radius: 50%;
  transition: transform var(--t-base); box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .ts-track { background: var(--primary); }
.toggle-switch input:checked + .ts-track::after { transform: translateX(-18px); }   /* RTL */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row-text .lbl { font-size: 13px; font-weight: 700; color: var(--ink); }
.toggle-row-text .desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.radio-group { display: grid; gap: 10px; }
.radio-card {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px;
  background: var(--bg); border: 1.5px solid var(--line-soft); border-radius: 12px;
  cursor: pointer; transition: all var(--t-fast);
}
.radio-card:hover { border-color: var(--primary); }
.radio-card.selected { background: var(--primary-soft); border-color: var(--primary); }
.radio-card .rc-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; margin-top: 1px; position: relative; }
.radio-card.selected .rc-dot { border-color: var(--primary); }
.radio-card.selected .rc-dot::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }

/* =============================================================
   12) MODAL
   ============================================================= */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 999; display: grid; place-items: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: opacity var(--t-base), visibility var(--t-base);
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--card); border-radius: var(--r-2xl);
  width: 100%; max-width: 660px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--sh-modal);
  transform: scale(0.96) translateY(16px); transition: transform 0.25s cubic-bezier(0.2,0.8,0.2,1); overflow: hidden;
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: all var(--t-fast); }
.modal-close:hover { background: var(--bg-2); color: var(--ink); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg); flex-shrink: 0; }

/* =============================================================
   13) SLIDE-OVER PANEL (تفاصيل السجل)
   ============================================================= */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 990; opacity: 0; visibility: hidden; transition: all var(--t-base); }
.panel-backdrop.open { opacity: 1; visibility: visible; }
.slide-panel {
  position: fixed; top: 0; left: 0; bottom: 0;        /* RTL: ينزلق من اليسار */
  width: min(560px, 100vw); background: var(--card); z-index: 1000;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform var(--t-panel); box-shadow: var(--sh-panel);
}
.slide-panel.open { transform: translateX(0); }
.panel-header { padding: 20px 24px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-shrink: 0; background: var(--card); }
.panel-header-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.panel-header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.panel-body-wrap { flex: 1; overflow-y: auto; padding: 22px 24px; }
.panel-section-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.panel-section-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.panel-footer { padding: 14px 24px; border-top: 1px solid var(--line-soft); background: var(--bg); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.panel-footer-status { flex: 1; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.panel-footer-status.saved { color: var(--ok-ink); }

/* =============================================================
   14) CONFIRM DIALOG (للحذف والإجراءات الخطرة)
   ============================================================= */
.confirm-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); z-index: 1100; display: grid; place-items: center; padding: 20px; opacity: 0; visibility: hidden; transition: all var(--t-base); }
.confirm-backdrop.open { opacity: 1; visibility: visible; }
.confirm-dialog { background: var(--card); border-radius: var(--r-xl); width: 100%; max-width: 420px; padding: 26px; text-align: center; box-shadow: var(--sh-modal); }
.confirm-icon-wrap { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%; background: var(--danger-bg); color: var(--danger); display: grid; place-items: center; }
.confirm-icon-wrap svg { width: 26px; height: 26px; }
.confirm-title { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.confirm-message { font-size: 13px; color: var(--ink-soft); line-height: 1.7; margin-bottom: 18px; }
.confirm-item-preview { background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 12px; margin-bottom: 18px; text-align: right; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions > * { flex: 1; }

/* =============================================================
   15) BULK ACTION BAR (شريط عائم عند التحديد الجماعي)
   ============================================================= */
.bulk-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120%);
  background: var(--ink); color: var(--card); padding: 12px 16px; border-radius: 16px;
  box-shadow: var(--sh-float); display: flex; align-items: center; gap: 14px;
  z-index: 300; transition: transform 0.4s cubic-bezier(0.32,0.72,0,1);
  max-width: calc(100vw - 40px); flex-wrap: wrap;
}
.bulk-bar.is-open { transform: translate(-50%, 0); }
.bulk-bar button { background: rgba(255,255,255,0.12); color: var(--card); border: none; border-radius: 9px; padding: 7px 13px; font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background var(--t-fast); }
.bulk-bar button:hover { background: rgba(255,255,255,0.22); }

/* =============================================================
   16) EMPTY STATE
   ============================================================= */
.empty-state { text-align: center; padding: 70px 20px; }
.empty-state-ic { width: 72px; height: 72px; margin: 0 auto 16px; background: var(--bg-2); border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.empty-state-ic svg { width: 28px; height: 28px; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--muted); margin: 0 auto 18px; max-width: 360px; line-height: 1.7; }
.empty-state.dashed { background: var(--card); border: 2px dashed var(--line); border-radius: 16px; }

/* =============================================================
   17) TABS
   ============================================================= */
.tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: var(--r-md); margin-bottom: 18px; width: fit-content; flex-wrap: wrap; }
.tab { padding: 9px 16px; background: transparent; border: none; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 7px; transition: all var(--t-base); }
.tab:hover:not(.active) { color: var(--ink); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--sh-card); }
.tab svg { width: 15px; height: 15px; }

/* =============================================================
   18) THEME SELECTOR (لوحة تبديل الألوان — تُوضع في الهيدر)
   ============================================================= */
.theme-selector { position: relative; }
.theme-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line-soft); color: var(--ink-soft);
  padding: 7px 14px 7px 10px; border-radius: var(--r-pill);
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; transition: all var(--t-base);
}
.theme-btn:hover { border-color: var(--primary); color: var(--ink); background: var(--bg-2); }
.theme-btn .theme-preview { width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--primary) 0 50%, var(--accent) 50% 100%); border: 1.5px solid var(--card); box-shadow: 0 0 0 1px var(--line); flex-shrink: 0; }
.theme-dropdown {
  position: absolute; top: calc(100% + 10px); left: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 18px; width: 320px; box-shadow: var(--sh-pop); z-index: 200;
  opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all var(--t-base);
}
.theme-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-cell { cursor: pointer; padding: 4px; border-radius: 12px; transition: all var(--t-fast); }
.theme-cell:hover { background: var(--bg-2); }
.theme-cell.active { background: var(--primary-soft); }
.theme-swatch { width: 100%; aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line), 0 2px 4px rgba(0,0,0,0.08); transition: all var(--t-fast); }
.theme-cell.active .theme-swatch { box-shadow: 0 0 0 2px var(--primary), 0 4px 8px rgba(0,0,0,0.12); }
.theme-cell-label { display: block; font-size: 10px; text-align: center; margin-top: 5px; color: var(--ink-soft); font-weight: 500; }
.theme-cell.active .theme-cell-label { color: var(--primary); font-weight: 700; }
.theme-swatch.sky    { background: linear-gradient(135deg, #0369a1 50%, #f59e0b 50%); }
.theme-swatch.olive  { background: linear-gradient(135deg, #556b2f 50%, #b8860b 50%); }
.theme-swatch.coral  { background: linear-gradient(135deg, #c44536 50%, #1e3a5f 50%); }
.theme-swatch.sand   { background: linear-gradient(135deg, #8b6914 50%, #5c3317 50%); }
.theme-swatch.slate  { background: linear-gradient(135deg, #334155 50%, #0d9488 50%); }
.theme-swatch.mint   { background: linear-gradient(135deg, #047857 50%, #7c3aed 50%); }
.theme-swatch.amber  { background: linear-gradient(135deg, #a16207 50%, #9a3412 50%); }
.theme-swatch.navy   { background: linear-gradient(135deg, #1e3a8a 50%, #c2410c 50%); }
.theme-swatch.plum   { background: linear-gradient(135deg, #86198f 50%, #ca8a04 50%); }
.theme-swatch.forest { background: linear-gradient(135deg, #14532d 50%, #b45309 50%); }
.theme-swatch.sunset { background: linear-gradient(135deg, #c2410c 50%, #1e3a8a 50%); }

/* =============================================================
   19) PAGE HERO (لوحة المعلومات / صفحات الترحيب)
   ============================================================= */
.page-hero {
  background: linear-gradient(135deg, var(--card) 0%, var(--bg) 50%, var(--primary-soft) 100%);
  border: 1px solid var(--line-soft); border-radius: var(--r-2xl);
  padding: 26px 30px; position: relative; overflow: hidden; margin-bottom: 16px;
}
@media (max-width: 600px) { .page-hero { padding: 20px 18px; } }
.page-hero-greet { font-size: 27px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; margin-bottom: 4px; line-height: 1.2; }
.page-hero-greet .name { color: var(--primary); }
.page-hero-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; line-height: 1.6; max-width: 620px; }
.page-hero-date {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: livePulse 1.6s ease-in-out infinite; }
@keyframes livePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); } 50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); } }

/* =============================================================
   20) UTILITIES + ANIMATIONS
   ============================================================= */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.fade-up { animation: fadeUp 0.6s cubic-bezier(0.2,0.8,0.2,1); }
.shake { animation: shake 0.4s; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; border: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =============================================================
   21) RESPONSIVE — قاعدة السايدبار
   ============================================================= */
@media (max-width: 1024px) {
  .sidebar { position: fixed; right: 0; top: 0; transform: translateX(100%); transition: transform var(--t-panel); }
  .sidebar.open { transform: translateX(0); }
  .app-content { padding: 20px 16px 40px; }
  .header-search { display: none; }
}
