/* هوية شركة علامة الجمال الدولية — مطابقة لنظام الطلبات */
:root {
  --bg: #F4F1EA;
  --card: #FFFFFF;
  --cream: #EDE8DC;
  --dark: #1D1D1B;
  --ink: #1D1D1B;
  --gray: #6E6A5C;
  --green: #1FA36A;
  --line: #E2DCCB;
  --orange-dark: #DE7B12;
  --orange: #F38F26;
  --purple: #2F2766;
  --purple-dark: #241E50;
  --red: #D64545;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  max-width: 100vw;
}

/* الشريط الجانبي */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand-icon { width: 40px; height: 40px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.4; }

nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.45);
  letter-spacing: .5px;
  padding: 14px 14px 6px;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 3px;
  font-weight: 500;
  font-size: 15px;
  transition: background .18s, transform .18s;
}
.nav-item span { font-size: 18px; }
.nav-item:hover { background: rgba(255,255,255,.10); }
.nav-item.active { background: var(--orange); color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(243,143,38,.35); }
.nav-ready {
  margin-inline-start: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--green);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
}

.side-user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.user-name { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.role-tag { font-size: 10px; font-weight: 700; background: rgba(255,255,255,.15); padding: 2px 8px; border-radius: 20px; }
.logout { color: rgba(255,255,255,.7); text-decoration: none; font-size: 13px; }
.logout:hover { color: #fff; }

/* المحتوى */
.main {
  flex: 1;
  margin-inline-start: 260px;
  padding: 32px 36px;
  animation: fadeIn .4s ease;
}
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 800; color: var(--purple-dark); }
.sub { color: var(--gray); font-size: 15px; margin-top: 4px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* مؤشرات إحصائية */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
  animation: riseIn .45s ease both;
}
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .10s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--purple-dark); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--gray); margin-top: 4px; font-weight: 500; }
.stat-green .stat-value { color: var(--green); }
.stat-amber .stat-value { color: var(--orange-dark); }

/* بطاقات الوحدات */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  text-decoration: none;
  color: var(--ink);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
  animation: riseIn .4s ease both;
}
.module-card::before {
  content: '';
  position: absolute; inset: 0 auto 0 0;
  width: 6px;
  background: var(--orange);
}
/* بطاقة تطبيق خارجي مستقل (يفتح بتبويب منفصل بدخول موحّد بلا كلمة مرور) */
.module-card.module-sso {
  border: 1.5px dashed #b9a9ef;
  background: linear-gradient(180deg, #faf8ff 0%, var(--card) 60%);
  box-shadow: 0 4px 14px rgba(47,39,102,.07);
}
.module-card.module-sso::before { display: none; }  /* بلا شريط جانبي — تمييز أنظف */
.module-card.module-sso::after {
  content: '↗';
  position: absolute;
  top: 14px; inset-inline-end: 16px;
  font-size: 26px; font-weight: 900;
  color: var(--orange);
  opacity: .9;
}
.module-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.7;
  color: #2f2766;
  background: #efeaff;
  border: 1px solid #d9cffb;
  padding: 5px 12px;
  border-radius: 20px;
}
.module-card.purple::before { background: var(--purple); }
.module-card.orange::before { background: var(--orange); }
.module-card.green::before { background: var(--green); }
.module-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(29,29,27,.12); border-color: var(--orange); }
.module-icon { font-size: 34px; margin-bottom: 12px; }
.module-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; color: var(--purple-dark); }
.module-desc { font-size: 13.5px; color: var(--gray); line-height: 1.6; }
.module-status {
  margin-top: 14px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  background: var(--cream);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 20px;
}
.module-status.status-live { color: var(--green); background: #E7F6EE; border-color: #BFE5D2; }

/* تسجيل الدخول */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--purple) 0%, var(--purple-dark) 100%);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 36px;
  width: 400px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(20,16,50,.35);
  animation: riseIn .5s ease;
}
.login-logo { height: 72px; width: auto; display: block; margin: 0 auto 12px; }
.login-form { text-align: right; margin-top: 20px; }
.login-form label { display: block; font-size: 13.5px; font-weight: 700; color: var(--gray); margin: 12px 0 6px; }
.login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: var(--bg);
}
.login-form input:focus { outline: 2px solid var(--orange); border-color: transparent; }

/* أزرار */
.btn-primary {
  width: 100%;
  margin-top: 22px;
  padding: 13px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--purple-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary.btn-sm { width: auto; margin-top: 0; padding: 10px 22px; font-size: 14px; }
.btn-danger { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.btn-danger:hover { background: #B93838; }
.btn-xs { padding: 4px 12px; font-size: 12px; }

/* لوحات وجداول */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  animation: riseIn .4s ease;
}
.panel-title { font-size: 16px; font-weight: 800; color: var(--purple-dark); margin-bottom: 16px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: right; padding: 10px 12px; color: var(--gray); font-weight: 700; font-size: 12.5px; border-bottom: 2px solid var(--line); }
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.mono { font-family: 'Courier New', monospace; font-size: 13px; }
.muted { color: var(--gray); font-size: 13px; }

.role-badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: var(--cream); color: var(--purple-dark); }
.role-badge.role-admin { background: var(--purple); color: #fff; }
.role-badge.role-hr { background: #E7EFFA; color: #0F75BC; }
.role-badge.role-purchasing, .role-badge.role-sales { background: #FDF0E0; color: var(--orange-dark); }
.role-badge.role-warehouse, .role-badge.role-social { background: #E7F6EE; color: var(--green); }
.role-badge.role-accounts { background: #EFE9FB; color: var(--purple); }

/* نماذج */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
  flex: 1;
  min-width: 140px;
}
.settings-form label { display: block; font-size: 13.5px; font-weight: 700; color: var(--gray); margin: 12px 0 6px; }
.settings-form input {
  width: 100%;
  max-width: 360px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: var(--bg);
}
.settings-form .btn-primary { max-width: 360px; }

/* هوية الشركة */
.brand-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.swatch { display: flex; align-items: center; gap: 10px; }
.swatch-color { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); }
.swatch-label { font-size: 13px; color: var(--ink); }
.swatch-label .mono { color: var(--gray); font-size: 12px; }

/* نماذج شبكية متعددة الأعمدة */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.grid-form.compact { gap: 12px; }
.grid-form label { display: block; font-size: 12.5px; font-weight: 700; color: var(--gray); margin: 10px 0 4px; }
.grid-form input, .grid-form select, .grid-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
}
.grid-form input:focus, .grid-form select:focus, .grid-form textarea:focus { outline: 2px solid var(--orange); border-color: transparent; }
.grid-form textarea { resize: vertical; }

/* أعمدة النموذج */
.form-col { display: flex; flex-direction: column; min-width: 0; }
.form-col input[type="file"] {
  padding: 8px;
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: var(--bg);
  cursor: pointer;
  width: 100%;
}
.form-col input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--purple-dark);
  background: #fff;
  border: 1px solid var(--purple);
  border-radius: 7px;
  padding: 5px 12px;
  margin-inline-end: 8px;
  cursor: pointer;
}

/* نموذج إضافة الموظف — أقسام مرتبة */
.add-emp-form { display: flex; flex-direction: column; gap: 18px; }
.form-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.form-section-head {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 18px;
}
.form-section-icon { font-size: 18px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 18px;
  padding: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--orange);
  border-color: transparent;
}
.field textarea { resize: vertical; }
.field-full { grid-column: 1 / -1; }
.field input[type="file"] {
  padding: 8px;
  font-size: 13px;
  border: 1px dashed var(--line);
  cursor: pointer;
}
.field input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--purple-dark);
  background: #fff;
  border: 1px solid var(--purple);
  border-radius: 7px;
  padding: 5px 12px;
  margin-inline-end: 8px;
  cursor: pointer;
}
.form-actions { display: flex; justify-content: flex-end; }
.form-actions .btn-primary { width: auto; min-width: 200px; margin-top: 0; }
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-actions .btn-primary { width: 100%; }
}

/* مجموعات أقسام لوحة التحكم */
.section-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 22px;
}
.section-group .form-section-head { border-radius: 0; }
.section-body { padding: 20px; }
.section-body .modules-grid { margin-bottom: 0; }

/* شارات الحالة */
.status-pill { font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 20px; }
.pill-live { color: var(--green); background: #E7F6EE; }
.pill-off { color: var(--gray); background: var(--cream); }
.pill-amber { color: var(--orange-dark); background: #FDF0E0; }
.pill-purple { color: var(--purple); background: #E9E5F5; }
.pill-danger { color: var(--red); background: #FBE9E9; }

/* تنبيهات */
.alert-panel { border-inline-start: 5px solid var(--orange); }
.alert-list { list-style: none; padding: 0; }
.alert-list li { padding: 8px 0; font-size: 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.alert-list li:last-child { border-bottom: none; }
.text-danger { color: var(--red); font-weight: 700; }

/* أزرار الإجراءات داخل الجدول */
.actions-cell { white-space: nowrap; }
.icon-act {
  background: none; border: none; cursor: pointer;
  font-size: 17px; padding: 4px 6px; text-decoration: none;
  border-radius: 6px; transition: background .15s;
}
.icon-act:hover { background: var(--cream); }
.icon-act.danger:hover { background: #FBE9E9; }
.table-wrap { overflow-x: auto; }

/* ===== خلايا جدول الأصناف ===== */
.nowrap { white-space: nowrap; }
.item-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.cell-product { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-names { min-width: 0; }
.item-names strong { display: block; word-break: break-word; }
.item-names .muted { word-break: break-word; }
.hide-mobile { }

/* التبويبات الفرعية */
.subnav {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.subnav-item {
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gray);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.subnav-item:hover { background: var(--bg); color: var(--purple-dark); }
.subnav-item.active { background: var(--purple); color: #fff; }

/* اختيار نوع الموظف */
.type-chooser { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.type-card {
  display: block;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 32px 26px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .18s, transform .18s, box-shadow .18s;
  animation: riseIn .4s ease;
}
.type-card:hover { border-color: var(--purple); transform: translateY(-3px); box-shadow: 0 10px 26px rgba(29,29,27,.12); }
.type-icon { font-size: 44px; margin-bottom: 14px; }
.type-title { font-size: 19px; font-weight: 800; color: var(--purple-dark); margin-bottom: 8px; }
.type-desc { font-size: 13.5px; color: var(--gray); line-height: 1.7; }

/* بطاقات التصدير */
.export-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.export-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  animation: riseIn .4s ease;
}
.export-icon { font-size: 38px; margin-bottom: 12px; }
.export-title { font-size: 17px; font-weight: 800; color: var(--purple-dark); margin-bottom: 8px; }
.export-desc { font-size: 13.5px; color: var(--gray); line-height: 1.7; flex: 1; }
.export-note { font-size: 12px; color: var(--orange-dark); font-weight: 700; margin: 12px 0; }
.export-card .btn-primary { margin-top: 0; }

/* النظرة العامة: عمودان + حلقة السعودة */
.overview-cols { display: grid; grid-template-columns: 320px 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .overview-cols { grid-template-columns: 1fr; } }
.saudi-panel { text-align: center; }
.saudi-ring {
  width: 150px; height: 150px; margin: 14px auto;
  border-radius: 50%;
  background: conic-gradient(var(--purple) calc(var(--pct) * 1%), var(--cream) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.saudi-ring-inner {
  width: 116px; height: 116px; border-radius: 50%;
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.saudi-pct { font-size: 26px; font-weight: 800; color: var(--purple-dark); }
.saudi-lbl { font-size: 12px; color: var(--gray); }
.saudi-stats { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.saudi-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); justify-content: center; }
.saudi-item strong { color: var(--purple-dark); }

/* مقارنة السعودة */
.saudi-compare { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.saudi-cmp-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--gray); }
.saudi-cmp-row strong { color: var(--ink); }
.saudi-cmp-row.cmp-short strong { color: var(--red); }
.saudi-cmp-row.cmp-met strong { color: var(--green); }
.saudi-verdict { margin-top: 10px; padding: 7px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.verdict-short { background: #FBE9E9; color: var(--red); }
.verdict-met { background: #E7F6EE; color: var(--green); }
.saudi-ring.ring-short { background: conic-gradient(var(--red) calc(var(--pct) * 1%), var(--cream) 0); }

/* نقاط الحالة */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-saudi { background: var(--purple); }
.dot-nonsaudi { background: var(--orange); }
.dot-danger { background: var(--red); }
.dot-warn { background: var(--orange); }
.dot-info { background: #F2C94C; }

/* تنبيهات متعددة المستويات */
.alert-li { display: flex; align-items: center; gap: 8px; }
.alert-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.level-danger .alert-dot { background: var(--red); }
.level-warn .alert-dot { background: var(--orange); }
.level-info .alert-dot { background: #F2C94C; }
.level-danger { color: var(--red); }
.legend { display: flex; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray); }

/* مربع اختيار */
.chk-label { display: flex !important; align-items: center; gap: 8px; font-size: 13px !important; font-weight: 700 !important; color: var(--purple-dark) !important; cursor: pointer; }
.chk-label input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--purple); cursor: pointer; }

/* رأس الصفحة مع أزرار */
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-outline {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--purple);
  border-radius: 9px;
  color: var(--purple);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  background: #fff;
  transition: background .15s, color .15s;
}
.btn-outline:hover { background: var(--purple); color: #fff; }

/* بطاقات الموظفين */
.emp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.emp-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  transition: box-shadow .18s, transform .18s;
  animation: riseIn .35s ease both;
}
.emp-card:hover { box-shadow: 0 8px 22px rgba(29,29,27,.10); transform: translateY(-2px); }
.emp-card.emp-off { opacity: .55; }
.emp-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.emp-avatar {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--purple);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.emp-head-info { flex: 1; min-width: 0; }
.emp-name { font-weight: 800; font-size: 16px; color: var(--purple-dark); }
.emp-pos { font-size: 12.5px; color: var(--gray); }
.emp-type-badge {
  font-size: 11px; font-weight: 700;
  background: var(--cream); color: var(--purple-dark);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.emp-type-badge.type-contract { background: #E7F6EE; color: var(--green); }
.emp-body { border-top: 1px solid var(--line); padding-top: 10px; }
.emp-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13.5px; }
.emp-row span { color: var(--gray); }
.emp-row strong { color: var(--ink); }
.emp-files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  background: var(--cream); color: var(--purple-dark);
  padding: 4px 10px; border-radius: 20px;
  text-decoration: none;
}
.file-chip a { color: var(--orange-dark); font-weight: 700; text-decoration: none; }
.file-chip:hover { background: #e6dfca; }
.emp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.chip-btn {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 700; font-family: inherit;
  color: var(--purple-dark); cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.chip-btn:hover { background: var(--cream); }
.chip-btn.danger { color: var(--red); }
.chip-btn.danger:hover { background: #FBE9E9; }

/* وسم بيانات الكفالة */
.kafala-tag {
  font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: var(--orange-dark); background: #FDF0E0;
  padding: 4px 12px; border-radius: 20px; display: inline-block; margin-bottom: 4px;
}

/* النوافذ المنبثقة */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,16,50,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  animation: riseIn .25s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 17px; font-weight: 800; color: var(--purple-dark);
  margin-bottom: 18px;
}
.modal-close {
  color: var(--gray);
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--cream);
  border: 1px solid var(--line);
  line-height: 1;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ملخص السلف */
.salf-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.salf-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; text-align: center; font-size: 12.5px; color: var(--gray);
}
.salf-box strong { display: block; font-size: 19px; color: var(--purple-dark); margin-top: 4px; }
.salf-box.salf-red strong { color: var(--red); }
.salf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.salf-sub { font-size: 14px; font-weight: 800; color: var(--purple-dark); margin-bottom: 8px; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

@media (max-width: 760px) {
  .salf-grid { grid-template-columns: 1fr; }
}

/* رسائل */
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  animation: riseIn .3s ease;
}
.flash.error { background: #FBE9E9; color: var(--red); border: 1px solid #F0C4C4; }
.flash.info { background: var(--cream); color: var(--purple-dark); border: 1px solid var(--line); }

/* وحدة قيد الإنشاء */
.module-placeholder {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 70px 40px;
  text-align: center;
}
.placeholder-icon { font-size: 60px; margin-bottom: 16px; }
.module-placeholder h1 { font-size: 24px; font-weight: 800; color: var(--purple-dark); margin-bottom: 8px; }
.placeholder-badge {
  display: inline-block;
  margin-top: 18px;
  font-weight: 700;
  color: var(--purple-dark);
  background: var(--cream);
  border: 1px solid var(--line);
  padding: 6px 18px;
  border-radius: 20px;
}

/* ===== قائمة همبرغر (جوال) ===== */
.burger {
  display: none;
  position: fixed;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 1100;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
  color: var(--purple-dark);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(29,29,27,.12);
  align-items: center; justify-content: center;
}
.back-btn {
  display: flex;
  position: fixed;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 1100;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
  color: var(--purple-dark);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(29,29,27,.12);
  align-items: center; justify-content: center;
  text-decoration: none;
}
.back-btn:hover { background: var(--cream); }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20,16,50,.5);
  z-index: 1050;
}

/* ===== آيفون (عرض ≤ 480px) ===== */
@media (max-width: 480px) {
  body { display: block; }
  .burger { display: flex; }
  .sidebar {
    width: 280px;
    transform: translateX(100%);
    transition: transform .28s ease;
    z-index: 1060;
    box-shadow: -8px 0 30px rgba(20,16,50,.30);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-overlay { display: block; }
  body.nav-open { overflow: hidden; }
  /* استعادة النصوص داخل الشريط المنزلق */
  .sidebar .brand-name, .sidebar .nav-item { font-size: initial; }
  .sidebar .nav-item { font-size: 15px; }
  .sidebar .nav-group-label { display: block; }
  .sidebar .nav-ready { display: inline-block; }
  .main { margin-inline-start: 0; padding: 70px 16px 24px; width: 100%; max-width: 100vw; min-width: 0; box-sizing: border-box; overflow-x: hidden; }
  .page-head h1 { font-size: 21px; }
  .sub { font-size: 13.5px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 24px; }
  .modules-grid, .emp-cards, .export-cards, .type-chooser { grid-template-columns: 1fr; }
  .overview-cols { grid-template-columns: 1fr; }
  .panel { padding: 16px 14px; }
  .head-row { flex-direction: column; align-items: stretch; }
  .head-actions { width: 100%; }
  .head-actions .btn-primary, .head-actions .btn-outline { width: 100%; text-align: center; }
  .login-card { width: auto; max-width: 92vw; padding: 30px 22px; margin: 0 16px; }
  .login-logo { height: 60px; }
  .grid-form { grid-template-columns: 1fr; }
  .subnav { overflow-x: auto; flex-wrap: nowrap; padding: 5px; }
  .subnav-item { flex: 0 0 auto; }
  .salf-grid { grid-template-columns: 1fr; }
  .modal { max-width: 96vw; padding: 18px 14px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select { min-width: 0; width: 100%; }
  .btn-primary.btn-sm { width: 100%; text-align: center; }
  .saudi-ring { width: 130px; height: 130px; }
  .saudi-ring-inner { width: 100px; height: 100px; }
  .saudi-pct { font-size: 22px; }
  /* جداول: أعمدة أساسية فقط على الجوال (إخفاء الثانوية) */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 0; width: 100%; }
  .hide-mobile { display: none; }
}

/* ===== آيباد (481px – 900px) ===== */
@media (min-width: 481px) and (max-width: 900px) {
  body { display: block; }
  .burger { display: flex; }
  .sidebar {
    width: 280px;
    transform: translateX(100%);
    transition: transform .28s ease;
    z-index: 1060;
    box-shadow: -8px 0 30px rgba(20,16,50,.30);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-overlay { display: block; }
  body.nav-open { overflow: hidden; }
  .sidebar .brand-name, .sidebar .nav-item { font-size: initial; }
  .sidebar .nav-item { font-size: 15px; }
  .sidebar .nav-group-label { display: block; }
  .sidebar .nav-ready { display: inline-block; }
  .main { margin-inline-start: 0; padding: 70px 24px 28px; width: 100%; max-width: 100vw; min-width: 0; box-sizing: border-box; overflow-x: hidden; }
  .modules-grid, .emp-cards { grid-template-columns: repeat(2, 1fr); }
  .overview-cols { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hide-mobile { display: none; }
}
