/* style.css — تصميم الواجهة (B2B CRM)
   💡 نستخدم الخصائص المنطقية (logical properties) مثل text-align: start و margin-inline-start
      بدل right/left، حتى يعمل التصميم تلقائياً في العربي (rtl) والإنجليزي (ltr) */

/* ═════════════ المتغيرات (CSS variables) — الألوان والمقاسات في مكان واحد ═════════════ */
:root {
  --bg: #eef1fa;
  /* خلفية النظام: بقع ألوان ناعمة بألوان الشعار (نيلي / بنفسجي / أخضر مزرق / ذهبي) + نقاط خفيفة جداً */
  --bg-art:
    radial-gradient(1000px 700px at 0% 0%, rgba(99, 102, 241, .30), transparent 60%),
    radial-gradient(900px 600px at 55% 0%, rgba(168, 85, 247, .18), transparent 60%),
    radial-gradient(1000px 700px at 100% 100%, rgba(20, 184, 166, .24), transparent 60%),
    radial-gradient(800px 600px at 0% 100%, rgba(245, 158, 11, .16), transparent 60%),
    radial-gradient(rgba(67, 56, 202, .11) 1px, transparent 1.3px),
    linear-gradient(160deg, #eef2ff, #f5f3ff 45%, #effcf9);
  --bg-art-size: auto, auto, auto, auto, 22px 22px, auto; /* طبقة النقاط تتكرر كل 22px */
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #4338ca;
  --primary-600: #4f46e5;
  --primary-50: #eef2ff;
  --green: #059669;  --green-50: #ecfdf5;
  --amber: #d97706;  --amber-50: #fffbeb;
  --red: #dc2626;    --red-50: #fef2f2;
  --blue: #2563eb;   --blue-50: #eff6ff;
  --teal: #0d9488;   --teal-50: #f0fdfa;
  --cyan: #0891b2;   --cyan-50: #ecfeff;
  --purple: #7c3aed; --purple-50: #f5f3ff;
  --gray-50: #f1f5f9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden يُخفي العنصر دائماً حتى لو كان له display آخر */
body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-art);
  background-size: var(--bg-art-size);
  background-attachment: fixed; /* الخلفية ثابتة والمحتوى يتحرك فوقها عند التمرير */
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h3 { font-size: 15px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .02em; }
.link { color: var(--primary-600); font-weight: 500; }
.link:hover { text-decoration: underline; }
.currency { font-size: .78em; color: var(--muted); font-weight: 500; }

/* ═════════════ التخطيط: قائمة جانبية + محتوى ═════════════ */
.app { display: flex; min-height: 100vh; }
main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1500px; }

#sidebar {
  width: var(--sidebar); flex-shrink: 0;
  /* زجاج شفاف (glass): نرى ألوان الخلفية خلف القائمة بشكل ضبابي */
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-inline-end: 1px solid rgba(226, 232, 240, .9); z-index: 5;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.brand-name { flex: 1; min-width: 0; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
/* الشعار: صورة SVG (img/logo.svg) — خلفيته وزواياه مرسومة داخل الملف نفسه */
.brand-logo { width: 40px; height: 40px; flex-shrink: 0; display: block; }

#menu { flex: 1; overflow-y: auto; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; padding: 0 10px 6px; }
#sidebar a[data-page], .nav-button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; color: #334155; font: inherit; font-weight: 500;
  border: 0; background: none; cursor: pointer; text-align: start;
}
#sidebar a[data-page]:hover, .nav-button:hover { background: var(--gray-50); }
#menu a.active { background: var(--primary-50); color: var(--primary); }
#menu a.active .icon { color: var(--primary); }
/* عدّاد بجانب "المواعيد" و"التنبيهات" — أحمر إذا يوجد فائت أو عاجل */
.nav-badge { margin-inline-start: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary-600); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-badge.urgent { background: var(--red); }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 4px; }
.user-card b { display: block; font-size: 13px; }
.user-card small { color: var(--muted); font-size: 12px; }
.sidebar-footer a.active { background: var(--primary-50); }
.nav-button { color: var(--red); }

/* صورة الموظف أو أول حرفين من اسمه */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  display: inline-grid; place-items: center; background: var(--primary-50); color: var(--primary); font-weight: 700; font-size: 13px;
}
.avatar.small { width: 30px; height: 30px; font-size: 12px; }
.avatar.large { width: 84px; height: 84px; font-size: 28px; }

/* ═════════════ رأس الصفحة ═════════════ */
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { display: flex; align-items: center; gap: 12px; }
.page-title h1 { font-size: 22px; font-weight: 700; }
.page-title p { margin: 2px 0 0; color: var(--muted); }
.page-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--primary); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ═════════════ البطاقات والشبكات ═════════════ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title h3 { display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }

/* بطاقات الأرقام (KPI) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: .15s; }
a.kpi:hover { border-color: #c7d2fe; transform: translateY(-1px); }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-body { display: grid; gap: 2px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 22px; font-weight: 700; }
.kpi-hint { color: var(--muted); font-size: 12px; }
.kpi-grid.small .kpi-value { font-size: 18px; }

/* ألوان الأيقونات والشارات (tones) */
.indigo { background: var(--primary-50); color: var(--primary); }
.teal { background: var(--teal-50); color: var(--teal); }
.blue { background: var(--blue-50); color: var(--blue); }
.amber { background: var(--amber-50); color: var(--amber); }
.green { background: var(--green-50); color: var(--green); }
.cyan { background: var(--cyan-50); color: var(--cyan); }
.purple { background: var(--purple-50); color: var(--purple); }
.red { background: var(--red-50); color: var(--red); }
.gray { background: var(--gray-50); color: #475569; }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip { display: inline-block; background: var(--gray-50); border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font-size: 12px; margin: 1px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--gray-50); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; color: var(--muted); }
.yes { color: var(--green); }

/* ═════════════ الأزرار ═════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary-600); color: #fff; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { background: var(--primary); }
.btn.light { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.light:hover { background: var(--gray-50); }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.tiny { padding: 3px 9px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; padding: 11px; }
.icon-btn { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; font-size: 16px; }
.icon-btn:hover { background: var(--gray-50); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-50); color: var(--red); }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.buttons-inline { display: flex; gap: 8px; flex-wrap: wrap; }

/* أزرار مجمّعة (لوحة / جدول) */
.segmented { display: inline-flex; background: var(--gray-50); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ═════════════ النماذج (forms) ═════════════ */
label { display: block; font-size: 13px; color: #475569; margin-bottom: 5px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--text); background: var(--surface); transition: .15s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: #a5b4fc; box-shadow: 0 0 0 3px var(--primary-50); }
textarea { resize: vertical; }
.req { color: var(--red); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border: 0; padding: 0; margin: 0; }
.form .full { grid-column: 1 / -1; }
.form-section { font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 6px; }
.form-section:first-child { margin-top: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; margin: 0; cursor: pointer; font-weight: 400; color: var(--text); }
.check input { width: auto; }
.check:has(input:checked) { border-color: #a5b4fc; background: var(--primary-50); } /* المربع المختار يتلوّن */
.check:has(input:disabled) { cursor: default; opacity: .8; }
.role-hint { margin: -4px 0 0; font-size: 12px; display: flex; gap: 6px; align-items: center; } /* شرح الأدوار تحت قائمة الدور */

/* ═════════════ صفحة الأقسام: بطاقة لكل قسم بموظفيه + زر "إنشاء حساب جديد" ═════════════ */
.page-intro { display: flex; gap: 6px; align-items: center; margin: -8px 0 16px; line-height: 1.8; }
.departments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; align-items: start; }
.departments-grid .card { margin: 0; }
.department-card { display: grid; gap: 14px; }
.department-head { display: flex; align-items: center; gap: 10px; }
.department-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-50); color: var(--primary); }
.department-title { flex: 1; min-width: 0; }
.department-title small { display: block; }
.department-pages { display: flex; flex-wrap: wrap; gap: 2px; }
/* قائمة الموظفين: صورة + الاسم والبريد + الدور + الأزرار */
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.member-name { flex: 1; min-width: 0; }
.member-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-list .no-members { justify-content: center; padding: 14px; color: var(--muted); border-style: dashed; background: none; }
.department-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.new-account { border-style: dashed; color: var(--primary-600); }
.new-account:hover { background: var(--primary-50); border-color: #a5b4fc; }
.no-department-card { border-color: #fecaca; }
.no-department-card h3 { color: var(--red); }

/* ═════════════ نظرة الإدارة في لوحة التحكم (لمدير النظام) ═════════════ */
.admin-overview { border-color: #c7d2fe; }
.overview-block + .overview-block { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.overview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.overview-head b { display: inline-flex; align-items: center; gap: 6px; }
.overview-head .link { margin-inline-start: auto; font-size: 13px; }
.small-search { flex: 0 1 280px; min-width: 200px; margin-inline-start: auto; }
.small-search input { padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
/* بطاقات الأقسام: رابط لأعمال القسم، والقسم الذي فيه متأخرات يتلوّن بالأحمر */
.overview-depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.overview-dept { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); transition: .15s; }
.overview-dept:hover { border-color: #a5b4fc; transform: translateY(-1px); }
.overview-dept.has-overdue { border-color: #fecaca; }
.overview-dept > div { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.overview-dept small { font-size: 12px; }
.overview-companies { max-height: 420px; overflow-y: auto; }
button.filter-chip { font: inherit; cursor: pointer; }

/* أعمال كل موظف: بطاقة لكل موظف (رأس فيه شريط الإنجاز) وتحتها أعماله بحالة كل عمل */
.assign-grid { display: grid; gap: 10px; }
.assign-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.assign-card.has-overdue { border-color: #fecaca; }
.assign-card summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; list-style: none; background: var(--surface-2); }
.assign-card summary::-webkit-details-marker { display: none; }
.assign-card[open] summary { border-bottom: 1px solid var(--line); }
.assign-who { flex: 1; min-width: 160px; display: grid; gap: 3px; }
.assign-progress { display: grid; gap: 3px; width: 170px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--gray-50); border: 1px solid var(--line); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #34d399); }
.assign-progress small { font-size: 12px; color: var(--muted); }
.assign-counts { display: flex; gap: 4px; }
.assign-counts .badge, .assign-state { gap: 4px; }
.assign-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 6px; }
.assign-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); }
.assign-item.state-overdue { border-color: #fecaca; background: var(--red-50); }
.assign-item.state-done .assign-main > .link { text-decoration: line-through; text-decoration-color: rgba(5, 150, 105, .45); } /* المنجز مشطوب بخفة */
.assign-item.state-cancelled { opacity: .65; }
.assign-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-50); color: var(--primary); }
.assign-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.assign-main small { font-size: 12px; overflow-wrap: anywhere; }
.assign-note { color: var(--text); display: inline-flex; gap: 4px; align-items: center; }
.assign-file { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.assign-state { flex-shrink: 0; }
.assign-none { margin: 0; padding: 12px 14px; }

/* ═════════════ أعمال الموظفين (لمدير النظام) ═════════════ */
/* أزرار الأقسام أعلى الصفحة: "كل الأقسام" + قسم لكل زر مع عدد موظفيه */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; transition: .15s; }
.filter-chip:hover { border-color: #a5b4fc; }
.filter-chip .count { background: var(--gray-50); border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.filter-chip.active { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.filter-chip.active .count { background: rgba(255, 255, 255, .2); color: #fff; }
/* جدول الموظفين: الصف كله قابل للضغط، ومن عليه متأخرات يتميّز بخط أحمر في بدايته */
.work-table tbody tr { cursor: pointer; }
.work-table tbody tr:hover td { background: var(--primary-50); }
.work-table tr.needs-attention td:first-child { box-shadow: inset 3px 0 0 var(--red); }
[dir="rtl"] .work-table tr.needs-attention td:first-child { box-shadow: inset -3px 0 0 var(--red); }
.work-cell { display: grid; gap: 3px; justify-items: start; }
.work-cell small { font-size: 12px; }
.work-depts { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
/* صفحة الموظف: الرأس + قوائم أعماله */
.employee-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.employee-info { flex: 1; min-width: 240px; }
.employee-info h2 { font-size: 22px; }
.employee-info p { margin: 2px 0 0; }
.employee-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 13px; }
.employee-meta span[dir] { display: inline-flex; gap: 4px; align-items: center; }
.employee-last { display: grid; gap: 2px; justify-items: center; padding: 10px 18px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.employee-last b { font-size: 16px; }
.count-pill { background: var(--gray-50); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; font-size: 12px; color: var(--muted); }
.work-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 380px; overflow-y: auto; }
.work-list li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.work-list li.late { border-color: #fecaca; background: var(--red-50); }
.work-item-main { display: grid; gap: 2px; min-width: 0; }
.work-item-main small { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-item-side { display: grid; gap: 4px; justify-items: end; flex-shrink: 0; text-align: end; }
.late-date { color: var(--red); font-weight: 600; }
.readonly-value { padding: 9px 0; font-weight: 600; }
.weekday { display: block; margin-top: 4px; color: var(--primary); font-weight: 600; font-size: 12px; min-height: 18px; } /* اسم اليوم تحت التاريخ */
.invite-box { display: grid; gap: 6px; background: var(--primary-50); border: 1px solid #c7d2fe; border-radius: 12px; padding: 12px 14px; }
.invite-box .check { background: var(--surface); }
/* إنجاز المهمة: مربع سحب وإفلات للملف + الملف المختار */
.task-complete-title { margin: -6px 0 16px; }
.dropzone {
  display: grid; justify-items: center; gap: 4px; padding: 22px 16px; margin-bottom: 10px; text-align: center; cursor: pointer;
  border: 2px dashed #c7d2fe; border-radius: 14px; background: var(--primary-50); color: var(--text); transition: .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--primary-600); background: #e0e7ff; }
.dropzone.dragging { transform: scale(1.01); }
.dropzone.has-file { padding: 12px 16px; border-style: solid; } /* بعد الاختيار يصغر المربع */
.dropzone-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--primary-600); box-shadow: var(--shadow); }
.dropzone.has-file .dropzone-icon { display: none; }
.chosen-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; margin-bottom: 14px; border: 1px solid #a7f3d0; border-radius: 10px; background: var(--green-50); }

/* أدوات رابط الاجتماع تحت الحقل: "الرابط جاهز" + نسخ + تجربة + رابط جديد */
.link-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.link-ready { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-weight: 600; font-size: 12px; margin-inline-end: auto; }
#f-meetingLink:not(:placeholder-shown) { font-family: ui-monospace, Consolas, monospace; font-size: 13px; } /* الرابط بخط ثابت العرض */
.btn.join { background: var(--green); }
.btn.join:hover { background: #047857; }
fieldset[disabled] input { background: var(--surface-2); }

/* شريط الأدوات: بحث + فلاتر */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 220px; margin: 0; }
.search .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-inline-start: 34px; }
.filter { margin: 0; min-width: 150px; }
.filter span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* ═════════════ الجداول ═════════════ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: start; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafbff; }
td.wrap { white-space: normal; min-width: 200px; max-width: 360px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-actions { text-align: end; white-space: nowrap; width: 1%; }
/* عمود الأزرار (إنجاز / تعديل / حذف) ثابت في طرف الجدول حتى لو كان الجدول عريضاً ويتحرك أفقياً (sticky) */
td.row-actions, th:last-child { position: sticky; inset-inline-end: 0; z-index: 1; border-inline-start: 1px solid var(--line); }
td.row-actions { background: var(--surface); }
tr.clickable:hover td.row-actions { background: #fafbff; }
.file-link { display: inline-flex; align-items: center; gap: 4px; color: var(--primary-600); font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .file-link { max-width: 170px; } /* داخل الجداول: اسم الملف الطويل يُختصر بـ ... */
.person { display: flex; align-items: center; gap: 10px; }
.person b, .person small { display: block; }

.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty .icon { color: #cbd5e1; }
.empty p { margin: 8px 0 0; }
.loading { text-align: center; color: var(--muted); padding: 30px; }

/* ═════════════ النافذة المنبثقة (modal) والرسالة القصيرة (toast) ═════════════ */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 18px; z-index: 50; backdrop-filter: blur(2px); }
.dialog { background: var(--surface); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.dialog.lg { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
#toast { position: fixed; bottom: 22px; inset-inline-start: 22px; background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; z-index: 60; max-width: 420px; font-weight: 500; }
#toast.show { opacity: 1; transform: none; }
#toast.success { background: #065f46; }
#toast.error { background: #991b1b; }

/* ═════════════ ملف الشركة ═════════════ */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
[dir="rtl"] .back-link .icon { transform: scaleX(1); }
[dir="ltr"] .back-link .icon { transform: scaleX(-1); }
.profile-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.profile-id { display: flex; gap: 16px; align-items: flex-start; }
.company-avatar { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary-600), var(--purple)); flex-shrink: 0; }
.profile-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-name h1 { font-size: 22px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: #475569; font-size: 13px; }
.facts span { display: inline-flex; align-items: center; gap: 5px; }
.profile-actions { display: flex; align-items: center; gap: 8px; }
.owner-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--gray-50); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-weight: 500; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mini-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.mini-stat span { color: var(--muted); font-size: 12px; }
.mini-stat b { font-size: 18px; }
.mini-stat small { color: var(--muted); font-size: 12px; }

.tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; } /* wrap: التبويبات تنزل لسطر ثانٍ بدل شريط تمرير */
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 10px 12px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
#tab-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-height: 200px; }
.tab-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.info-grid .card { margin: 0; box-shadow: none; }
.info-grid h3 { margin-bottom: 12px; color: var(--primary); }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }

/* نقاط "جارٍ..." المتحركة (مثلاً أثناء رفع ملف إنجاز المهمة) */
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-600); animation: typing 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* الخط الزمني للأنشطة (Timeline) */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; top: 4px; bottom: 4px; inset-inline-start: 15px; width: 2px; background: var(--line); }
.timeline li { display: flex; gap: 14px; padding: 8px 0; cursor: pointer; position: relative; }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex-shrink: 0; z-index: 1; border: 3px solid var(--surface); }
.timeline-body { flex: 1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.timeline li:hover .timeline-body { border-color: #c7d2fe; }
.timeline-title { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timeline-body p { margin: 4px 0 0; color: #334155; white-space: pre-line; }

/* الملاحظات */
.note-compose { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; justify-content: space-between; }
.note p { margin: 0 0 10px; white-space: pre-line; }
.note footer { display: flex; justify-content: space-between; align-items: center; }

/* ═════════════ لوحة الفرص (Kanban) ═════════════ */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: flex-start; }
.board-col { flex: 1; min-width: 136px; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--primary-600); border-radius: 12px; padding: 10px; }
.board-col.stage-won { border-top-color: var(--green); }
.board-col.stage-lost { border-top-color: var(--red); }
.board-col-head { display: flex; justify-content: space-between; }
.board-col-total { display: block; color: var(--muted); margin-bottom: 10px; }
.board-empty { text-align: center; color: #cbd5e1; padding: 12px; }
.deal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: grid; gap: 5px; cursor: pointer; box-shadow: var(--shadow); }
.deal-card:hover { border-color: #c7d2fe; }
.deal-card .link.small { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.deal-meta { display: flex; justify-content: space-between; align-items: center; }
.deal-value { font-weight: 700; color: var(--primary); }
.deal-card select { padding: 5px 8px; font-size: 12px; }

/* ═════════════ المتابعات: 🔴 🟡 🟢 ═════════════ */
.followup-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.followup-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--text); }
.followup-col header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.followup-col .count { margin-inline-start: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.green { background: var(--green); }
.followup-col.red { border-top: 3px solid var(--red); }
.followup-col.amber { border-top: 3px solid var(--amber); }
.followup-col.green { border-top: 3px solid var(--green); }
.followup-col .empty { padding: 18px; }
.followup-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.followup-card:hover { border-color: #c7d2fe; }
.followup-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.followup-card p { margin: 6px 0; }
.followup-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ═════════════ لوحة التحكم ═════════════ */

.alert-list, .feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; }
.alert-list li.expired { background: var(--red-50); color: var(--red); }
.alert-list li.expiring { background: var(--amber-50); color: var(--amber); }
.alert-list a { color: var(--text); }
.alert-list small { display: block; }
.feed li { display: flex; gap: 10px; align-items: flex-start; }
.feed p { margin: 0; }
.feed-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--primary-600); }
.feed-dot.create { background: var(--green); }
.feed-dot.delete { background: var(--red); }

/* ═════════════ الرسوم البيانية (charts) ═════════════ */
.column-chart { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 8px; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.col-value { font-size: 11px; color: var(--muted); white-space: nowrap; }
.col-bar { width: 100%; max-width: 36px; min-height: 3px; background: linear-gradient(180deg, #818cf8, var(--primary-600)); border-radius: 6px 6px 2px 2px; }
.col-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; }
.bar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--gray-50); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary-600); border-radius: 999px; min-width: 4px; }
.bar-fill.green { background: var(--green); }
.bar-fill.red { background: var(--red); }
.bar-value { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ═════════════ المواعيد والتنبيهات (النافذة + القسمان) ═════════════ */
.alerts-title { display: flex; align-items: center; gap: 8px; }
.reminder-tabs { margin-bottom: 12px; }
.reminder-tabs .tab-count { background: var(--gray-50); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.reminder-tabs button.active .tab-count { background: var(--primary-600); color: #fff; border-color: transparent; }
.reminder-hint { margin: 0 0 12px; }

/* المواعيد: يوم + قائمة مواعيده */
.agenda { margin-top: 14px; }
.agenda-day { margin-bottom: 16px; }
.agenda-day h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; color: #334155; }
.agenda-day h4 .count { color: var(--muted); font-weight: 500; }
.agenda-day.today h4 { color: var(--primary); }
.agenda-day.overdue h4 { color: var(--red); }
.agenda-day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.appt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.appt.overdue { background: var(--red-50); border-color: #fecaca; }
.appt-time { min-width: 52px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); }
.appt.overdue .appt-time { color: var(--red); }
.appt-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-50); color: var(--primary); }
.appt-icon.followup { background: var(--amber-50); color: var(--amber); }
.appt-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.appt-main b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.appt-main small { color: var(--muted); font-size: 12px; }
.appt-main:hover b { color: var(--primary); }

/* التنبيهات: مجموعات */
.alert-groups { display: grid; gap: 14px; }
.alert-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.alert-cards .card { margin: 0; }
.alert-group h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; color: var(--primary); }
.alert-group h4 .count { color: var(--muted); font-weight: 500; }
.alert-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); border-inline-start-width: 4px; background: var(--surface); }
.alert-item.danger { border-inline-start-color: var(--red); background: var(--red-50); }
.alert-item.warning { border-inline-start-color: var(--amber); background: var(--amber-50); }
.alert-item.info { border-inline-start-color: var(--blue); }
.alert-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.alert-main:hover span { text-decoration: underline; }
.alert-main small { color: var(--muted); font-size: 12px; }

/* ═════════════ الإعدادات ═════════════ */
.profile-row { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.setup-steps { margin: 0 0 10px; padding-inline-start: 22px; display: grid; gap: 4px; }
.env-sample { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 12px 14px; font-size: 12px; overflow-x: auto; margin: 0; }
.sub-title { margin: 18px 0 8px; font-size: 14px; }

/* ═════════════ شاشة الدخول ═════════════ */
#login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; } /* نفس خلفية النظام (من body) */
.login-shell {
  display: grid; grid-template-columns: 1.08fr 1fr; width: 100%; max-width: 1060px; min-height: 640px;
  background: var(--surface); border-radius: 26px; overflow: hidden;
  box-shadow: 0 40px 90px rgba(49, 46, 129, .22), 0 0 0 1px rgba(255, 255, 255, .6);
  animation: login-in .6s ease-out both; /* البطاقة كلها تظهر بانزلاق خفيف */
}

/* ── جهة الهوية: تدرج داكن + بقع ألوان تتحرك + نقاط ── */
.login-art {
  position: relative; overflow: hidden; isolation: isolate; color: #fff; padding: 40px;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(155deg, #1e1b4b 0%, #3730a3 38%, #6d28d9 75%, #7c3aed 100%);
}
.login-art::after { /* شبكة نقاط تتلاشى من الأعلى والأسفل (mask) */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1.3px); background-size: 20px 20px;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.art-blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(50px); animation: blob-move 16s ease-in-out infinite; }
.art-blob.one { width: 320px; height: 320px; background: rgba(94, 234, 212, .35); top: -90px; inset-inline-end: -80px; }
.art-blob.two { width: 280px; height: 280px; background: rgba(252, 211, 77, .25); bottom: -100px; inset-inline-start: -60px; animation-delay: -5s; }
.art-blob.three { width: 240px; height: 240px; background: rgba(236, 72, 153, .22); top: 40%; inset-inline-end: 30%; animation-delay: -10s; }

.art-content { position: relative; z-index: 2; max-width: 360px; display: grid; gap: 14px; }
.login-logo { width: 76px; height: 76px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); animation: float-y 6s ease-in-out infinite; }
.login-art h1 { font-size: 30px; line-height: 1.25; }
.login-art p { margin: 0; opacity: .85; line-height: 1.8; }
.login-points { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 10px; }
.login-points li { display: flex; gap: 10px; align-items: center; animation: rise .5s ease-out both; animation-delay: calc(.5s + var(--i) * .15s); } /* تظهر واحدة بعد الأخرى */
.point-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); }

/* الأيقونات العائمة: كل واحدة بمكان (--d سرعة، --delay بداية، --r ميلان) مختلف حتى لا تتحرك معاً */
.float-icon {
  position: absolute; z-index: 1; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .15); animation: float-y var(--d, 7s) ease-in-out var(--delay, 0s) infinite;
}
/* أماكنها في الشريط الجانبي البعيد عن النص (inline-end) + زاويتان فارغتان — حتى لا تغطي الكلام في اللغتين */
.fi-1 { top: 21%; inset-inline-end: 9%; --d: 6s; --r: 8deg; }
.fi-2 { top: 37%; inset-inline-end: 18%; --d: 8s; --delay: -2s; --r: -10deg; width: 38px; height: 38px; }
.fi-3 { top: 53%; inset-inline-end: 6%; --d: 7s; --delay: -4s; --r: 6deg; }
.fi-4 { top: 69%; inset-inline-end: 15%; --d: 9s; --delay: -1s; --r: -6deg; width: 40px; height: 40px; }
.fi-5 { top: 8%; inset-inline-start: 46%; --d: 7.5s; --delay: -3s; --r: 12deg; width: 34px; height: 34px; opacity: .8; }
.fi-6 { bottom: 7%; inset-inline-start: 6%; --d: 8.5s; --delay: -5s; --r: -8deg; width: 36px; height: 36px; opacity: .8; }

/* ── نموذج الدخول ── */
.login-card { padding: 36px 42px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.login-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.login-mini-logo { width: 46px; height: 46px; }
.login-card h2 { font-size: 26px; }
.login-card form > p.muted { margin: 6px 0 24px; line-height: 1.7; }

/* سطر "ذكرني" + "نسيت كلمة المرور؟" */
.login-options { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -4px 0 6px; }
.remember { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; color: var(--text); font-weight: 500; }
.remember input { width: 17px; height: 17px; accent-color: var(--primary-600); cursor: pointer; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--primary-600); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* واجهتا "نسيت كلمة المرور" و"كلمة مرور جديدة" */
.view-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; background: var(--primary-50); color: var(--primary-600); }
.back-to-login { margin-top: 10px; }
[dir="ltr"] .back-to-login .icon { transform: scaleX(-1); } /* سهم "رجوع" يشير لبداية السطر في اللغتين */
.login-notice { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: -10px 0 16px; border-radius: 10px; border: 1px solid #a7f3d0; background: var(--green-50); color: var(--green); font-weight: 600; }
.login-success { display: grid; justify-items: center; gap: 10px; text-align: center; animation: rise .4s ease-out both; }
.login-success .view-icon { width: 66px; height: 66px; margin: 0; background: var(--green-50); color: var(--green); }
.login-success p { margin: 0; line-height: 1.8; }
.login-warning { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid #fde68a; background: var(--amber-50); color: #92400e; font-size: 13px; text-align: start; line-height: 1.7; }
.login-warning .icon { flex-shrink: 0; margin-top: 3px; }

/* حقل بأيقونة في بدايته (والأيقونة تتلوّن عند الكتابة فيه) */
.input-icon { position: relative; margin-bottom: 16px; }
.input-icon > .icon { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 13px; color: #94a3b8; pointer-events: none; transition: color .15s; }
/* مسافة متساوية من الجهتين: الحقل نفسه dir="ltr" داخل صفحة عربية، فالأيقونة قد تكون في أي جهة منه */
.input-icon input { padding: 12px 44px; border-radius: 12px; background: var(--surface-2); }
.input-icon input:focus { background: var(--surface); }
/* قائمة القسم: بنفس اتجاه الصفحة ← الأيقونة في البداية وسهم القائمة في النهاية */
.input-icon select { padding: 12px 12px; padding-inline-start: 44px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.input-icon select:focus { background: var(--surface); }
.input-icon:focus-within > .icon { color: var(--primary-600); }
.label-hint { font-weight: 400; color: var(--muted); font-size: 12px; } /* توضيح صغير بجانب اسم الحقل */
.pw-toggle { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 6px; display: grid; padding: 6px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.pw-toggle:hover { background: var(--gray-50); color: var(--text); }

/* زر الدخول: تدرج + سهم يتحرك عند المرور + دائرة تدور أثناء الدخول */
.login-submit { position: relative; gap: 8px; padding: 13px; border-radius: 12px; font-size: 15px; background: linear-gradient(135deg, var(--primary-600), var(--purple)); box-shadow: 0 10px 24px rgba(79, 70, 229, .35); }
.login-submit:hover { filter: brightness(1.06); box-shadow: 0 14px 30px rgba(79, 70, 229, .45); }
.login-submit .icon { transition: transform .2s; }
[dir="rtl"] .login-submit .icon { transform: scaleX(-1); }
.login-submit:hover .icon { transform: translateX(3px); }
[dir="rtl"] .login-submit:hover .icon { transform: scaleX(-1) translateX(3px); }
.login-submit.loading span, .login-submit.loading .icon { visibility: hidden; }
.login-submit.loading::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.error { color: var(--red); min-height: 22px; margin-bottom: 8px; font-weight: 500; }
.login-card.shake { animation: shake .45s ease-in-out; } /* هزّة عند كلمة مرور خاطئة */

/* حسابات التجربة: بطاقة لكل دور بأيقونته ولونه */
.demo { margin-top: 26px; }
.demo-title { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 10px; }
.demo-title span { flex: 1; height: 1px; background: var(--line); }
.demo-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-account { display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: start; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; cursor: pointer; transition: .15s; }
.demo-account:hover { border-color: #a5b4fc; transform: translateY(-2px); box-shadow: var(--shadow); }
.demo-account.active { border-color: var(--primary-600); background: var(--primary-50); box-shadow: 0 0 0 3px var(--primary-50); }
.demo-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.demo-avatar.admin { background: var(--purple-50); color: var(--purple); }
.demo-avatar.manager { background: var(--primary-50); color: var(--primary); }
.demo-avatar.sales { background: var(--green-50); color: var(--green); }
.demo-avatar.viewer { background: var(--gray-50); color: #475569; }
.demo-text { display: grid; min-width: 0; }
.demo-text b { font-size: 13px; }
.demo-text small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── الحركات (keyframes) ── */
@keyframes float-y { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-12px) rotate(var(--r, 0deg)); } }
@keyframes blob-move { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.1); } 66% { transform: translate(-30px, 30px) scale(.92); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes login-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* من فعّل "تقليل الحركة" في جهازه (لأسباب صحية أو للراحة): نوقف كل الحركات المستمرة */
@media (prefers-reduced-motion: reduce) {
  .login-shell, .login-logo, .float-icon, .art-blob, .login-points li, .login-card.shake, .typing i { animation: none !important; }
}

/* ═════════════ الشاشات الصغيرة (responsive) ═════════════ */
@media (max-width: 980px) {
  .app { flex-direction: column; }
  #sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; }
  .brand { padding: 0; }
  #menu { display: flex; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav-group { display: flex; margin: 0; }
  .nav-title { display: none; }
  #sidebar a[data-page] { white-space: nowrap; }
  .sidebar-footer { border: 0; padding: 0; display: flex; margin-inline-start: auto; }
  main { padding: 18px 14px 50px; }
  .grid-2, .info-grid, .alert-cards { grid-template-columns: 1fr; }
  .form, .details { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; max-width: 520px; }
  .login-art { display: none; }
  .login-card { padding: 28px 22px; }
}
