/* ============================================================
   منظومة الكوادر الذكية - Custom Stylesheet
   نظام إدارة الموارد البشرية الطبية العسكري
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary:       #1a3a5c;
  --primary-light: #24527a;
  --primary-dark:  #0f2238;
  --accent:        #d4a017;
  --accent-light:  #e8b82a;
  --accent-dark:   #b8860e;
  --white:         #ffffff;
  --gray-50:       #f8fafc;
  --gray-100:      #f1f5f9;
  --gray-200:      #e2e8f0;
  --gray-300:      #cbd5e1;
  --gray-400:      #94a3b8;
  --gray-500:      #64748b;
  --gray-600:      #475569;
  --gray-700:      #334155;
  --gray-800:      #1e293b;
  --gray-900:      #0f172a;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     24px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.07);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08);
  --shadow-xl:     0 20px 50px rgba(0,0,0,.18);
  --transition:    all .25s cubic-bezier(.4,0,.2,1);
  --transition-slow: all .4s cubic-bezier(.4,0,.2,1);
}

/* Dark mode variables */
.dark {
  --white:    #1e293b;
  --gray-50:  #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748b;
  --gray-500: #94a3b8;
  --gray-600: #cbd5e1;
  --gray-700: #e2e8f0;
  --gray-800: #f1f5f9;
  --gray-900: #f8fafc;
}

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

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: 'Cairo', 'Tajawal', 'Segoe UI', sans-serif;
  background-color: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}

.dark body {
  background-color: var(--gray-50);
  color: var(--gray-800);
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ---------- Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  transition: var(--transition-slow);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content.expanded {
  margin-right: var(--sidebar-collapsed);
}

.page-body {
  padding: 24px;
  flex: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition-slow);
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0,0,0,.2);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: var(--header-height);
  overflow: hidden;
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--white);
  box-shadow: 0 4px 12px rgba(212,160,23,.4);
}

.sidebar-logo .logo-text {
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-logo .logo-text h1 {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  white-space: nowrap;
}

.sidebar-logo .logo-text p {
  font-size: 10px;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  margin-top: 2px;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: rgba(255,255,255,.12);
  color: var(--white);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(212,160,23,.35);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-item .nav-label {
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  transition: var(--transition);
}

.sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 13px;
}

.sidebar-toggle-btn:hover {
  background: rgba(255,255,255,.15);
  color: var(--white);
}

.sidebar-toggle-btn .toggle-text {
  transition: var(--transition);
}

.sidebar.collapsed .toggle-text { opacity: 0; width: 0; overflow: hidden; }

/* ---------- Header ---------- */
.top-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 8px 40px 8px 16px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 50px;
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-800);
  transition: var(--transition);
  direction: rtl;
}

.header-search input:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,58,92,.1);
}

.header-search .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.header-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}

.header-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.header-btn .badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid var(--accent);
}

.user-info { display: flex; flex-direction: column; align-items: flex-end; }
.user-info .user-name { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.user-info .user-role { font-size: 11px; color: var(--gray-500); }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Glassmorphism Cards */
.glass-card {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.glass-card:hover {
  background: rgba(255,255,255,.85);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Stat Cards */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.stat-card.blue::before  { background: var(--info); }
.stat-card.green::before { background: var(--success); }
.stat-card.amber::before { background: var(--accent); }
.stat-card.red::before   { background: var(--danger); }

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(59,130,246,.12);  color: var(--info); }
.stat-icon.green  { background: rgba(16,185,129,.12);  color: var(--success); }
.stat-icon.amber  { background: rgba(212,160,23,.12);  color: var(--accent); }
.stat-icon.red    { background: rgba(239,68,68,.12);   color: var(--danger); }

.stat-info { flex: 1; }
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; font-weight: 500; }
.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-change.neutral { color: var(--gray-500); }

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(16,185,129,.12);  color: #059669; }
.badge-warning { background: rgba(245,158,11,.12);  color: #d97706; }
.badge-danger  { background: rgba(239,68,68,.12);   color: #dc2626; }
.badge-info    { background: rgba(59,130,246,.12);  color: #2563eb; }
.badge-gray    { background: rgba(100,116,139,.12); color: #475569; }
.badge-primary { background: rgba(26,58,92,.12);    color: var(--primary); }
.badge-accent  { background: rgba(212,160,23,.15);  color: var(--accent-dark); }

/* Status Dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-dot.offline { background: var(--gray-400); }
.status-dot.busy    { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.status-dot.leave   { background: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.status-dot.pulse   { animation: pulse-dot 1.5s infinite; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,.0); }
}

/* ---------- Progress Bars ---------- */
.progress-bar-wrap {
  background: var(--gray-200);
  border-radius: 50px;
  overflow: hidden;
  height: 8px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 50px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.progress-bar-fill.blue   { background: linear-gradient(90deg, var(--primary-light), var(--info)); }
.progress-bar-fill.green  { background: linear-gradient(90deg, #059669, var(--success)); }
.progress-bar-fill.amber  { background: linear-gradient(90deg, var(--accent-dark), var(--accent)); }
.progress-bar-fill.red    { background: linear-gradient(90deg, #dc2626, var(--danger)); }
.progress-bar-fill.purple { background: linear-gradient(90deg, #7c3aed, #a855f7); }

/* ---------- Alerts / AI Insights ---------- */
.alert-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border-right: 4px solid;
  transition: var(--transition);
}
.alert-card.danger  { background: rgba(239,68,68,.07);  border-color: var(--danger);  }
.alert-card.warning { background: rgba(245,158,11,.07); border-color: var(--warning); }
.alert-card.success { background: rgba(16,185,129,.07); border-color: var(--success); }
.alert-card.info    { background: rgba(59,130,246,.07); border-color: var(--info);    }

.alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.alert-card.danger  .alert-icon { color: var(--danger); }
.alert-card.warning .alert-icon { color: var(--warning); }
.alert-card.success .alert-icon { color: var(--success); }
.alert-card.info    .alert-icon { color: var(--info); }

.alert-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.alert-desc  { font-size: 12px; color: var(--gray-600); line-height: 1.5; }

/* ---------- Employee Cards ---------- */
.employee-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}
.employee-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.employee-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--gray-200);
  flex-shrink: 0;
}

/* ---------- Table Styles ---------- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.data-table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  padding: 12px 16px;
  text-align: right;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.data-table th:first-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.data-table th:last-child  { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(26,58,92,.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: 0 6px 16px rgba(26,58,92,.4);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(212,160,23,.3);
}
.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ---------- Form Inputs ---------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-800);
  transition: var(--transition);
  direction: rtl;
}
.form-control:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,58,92,.1);
}
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(.95) translateY(20px);
  transition: var(--transition);
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-body    { padding: 24px; }
.modal-footer  {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
}

/* ---------- Shift Calendar ---------- */
.shift-calendar {
  display: grid;
  gap: 1px;
  background: var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.shift-cell {
  background: var(--white);
  padding: 8px;
  min-height: 70px;
  transition: var(--transition);
}
.shift-cell:hover { background: var(--gray-50); }

.shift-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
  cursor: pointer;
  transition: var(--transition);
}
.shift-badge:hover { transform: scale(1.05); }
.shift-morning   { background: rgba(59,130,246,.15);  color: #1d4ed8; }
.shift-evening   { background: rgba(245,158,11,.15);  color: #b45309; }
.shift-night     { background: rgba(99,102,241,.15);  color: #4338ca; }
.shift-emergency { background: rgba(239,68,68,.15);   color: #b91c1c; }

/* ---------- Chatbot ---------- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 48px);
  max-height: 700px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.message-row.bot { flex-direction: row; }
.message-row.user { flex-direction: row-reverse; }

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.message-avatar.bot  { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.message-avatar.user { background: linear-gradient(135deg, var(--accent), var(--accent-dark));   color: white; }

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.6;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.message-bubble.bot {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-bottom-right-radius: 4px;
  color: var(--gray-800);
}
.message-bubble.user {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-bottom-left-radius: 4px;
}
.message-time {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 4px;
  text-align: center;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 4px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes typing {
  0%, 100% { transform: translateY(0); opacity: .4; }
  50%       { transform: translateY(-6px); opacity: 1; }
}

.chat-input-area {
  padding: 16px 20px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 50px;
  font-family: inherit;
  font-size: 13px;
  resize: none;
  max-height: 100px;
  direction: rtl;
  transition: var(--transition);
}
.chat-input:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary-light);
}
.chat-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(26,58,92,.3);
}
.chat-send-btn:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  transform: scale(1.05);
}

.quick-replies {
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--white);
  border-top: 1px solid var(--gray-100);
}
.quick-reply-btn {
  padding: 5px 14px;
  border: 1.5px solid var(--primary-light);
  border-radius: 50px;
  font-size: 12px;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.quick-reply-btn:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* ---------- Chart Containers ---------- */
.chart-wrapper {
  position: relative;
  width: 100%;
}
.chart-wrapper canvas { max-width: 100%; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-right: 20px; }
.timeline::before {
  content: '';
  position: absolute;
  right: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}
.timeline-item {
  position: relative;
  padding-right: 24px;
  padding-bottom: 20px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  right: -2px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,58,92,.2);
}
.timeline-item.success::before { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.timeline-item.warning::before { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.timeline-item.danger::before  { background: var(--danger);  box-shadow: 0 0 0 3px rgba(239,68,68,.2); }

/* ---------- Activity Feed ---------- */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.activity-content { flex: 1; }
.activity-text  { font-size: 13px; color: var(--gray-700); line-height: 1.4; }
.activity-time  { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

/* ---------- AI Prediction / Burnout ---------- */
.burnout-meter {
  height: 10px;
  border-radius: 50px;
  background: var(--gray-200);
  overflow: hidden;
}
.burnout-fill {
  height: 100%;
  border-radius: 50px;
  transition: width 1s ease;
}
.burnout-low    .burnout-fill { background: linear-gradient(90deg, #34d399, #10b981); }
.burnout-medium .burnout-fill { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.burnout-high   .burnout-fill { background: linear-gradient(90deg, #f87171, #ef4444); }
.burnout-critical .burnout-fill { background: linear-gradient(90deg, #ef4444, #b91c1c); animation: burnout-pulse 1.5s infinite; }

@keyframes burnout-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}

/* ---------- Severity Indicators ---------- */
.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
}
.severity-critical { background: rgba(185,28,28,.1); color: #b91c1c; }
.severity-high     { background: rgba(239,68,68,.1);  color: #dc2626; }
.severity-medium   { background: rgba(245,158,11,.1); color: #d97706; }
.severity-low      { background: rgba(16,185,129,.1); color: #059669; }
.severity-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse-dot 1.5s infinite; }

/* ---------- Page Header ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title .icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.page-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ---------- Tabs ---------- */
.tabs-nav {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  width: fit-content;
}
.tab-btn {
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { color: var(--gray-900); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- Notifications Dropdown ---------- */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: 340px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: var(--transition);
  max-height: 480px;
  overflow-y: auto;
}
.notification-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* ---------- User Profile Dropdown ---------- */
.user-dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 12px;
  border-right: 1px solid var(--gray-200);
  margin-right: 4px;
  cursor: pointer;
}
.user-dropdown-wrapper:hover .user-avatar {
  box-shadow: 0 0 0 3px rgba(212,160,23,.4);
}
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  width: 220px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: var(--transition);
  overflow: hidden;
}
.user-dropdown-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.user-dropdown-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-dropdown-header .udh-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}
.user-dropdown-header .udh-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.user-dropdown-header .udh-role { font-size: 11px; opacity: .75; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border-bottom: 1px solid var(--gray-100);
}
.user-dropdown-item:last-child { border-bottom: none; }
.user-dropdown-item:hover { background: var(--gray-50); color: var(--primary); }
.user-dropdown-item .udi-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.user-dropdown-item.danger { color: var(--danger); }
.user-dropdown-item.danger:hover { background: rgba(239,68,68,.06); color: var(--danger); }
.user-dropdown-item.danger .udi-icon { background: rgba(239,68,68,.1); color: var(--danger); }
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: var(--transition);
}
.notif-item:hover { background: var(--gray-50); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(26,58,92,.03); }
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* ---------- Search Filter Bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.filter-search {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.filter-search input {
  width: 100%;
  padding: 8px 40px 8px 14px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  direction: rtl;
  transition: var(--transition);
}
.filter-search input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: var(--white);
}
.filter-search .icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 13px;
}
.filter-select {
  padding: 8px 14px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-700);
  cursor: pointer;
  direction: rtl;
  transition: var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--primary-light); }

/* ---------- Section Dividers ---------- */
.section-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ---------- Gradient Background Sections ---------- */
.gradient-bg {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: white;
}

.accent-gradient-bg {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  color: white;
}

/* ---------- Animated Counters ---------- */
.animated-counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ---------- AI Badge ---------- */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.15));
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  color: #6366f1;
}

/* ---------- Department Tags ---------- */
.dept-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.dept-emergency { background: rgba(239,68,68,.1);  color: #b91c1c; }
.dept-icu       { background: rgba(99,102,241,.1); color: #4338ca; }
.dept-surgery   { background: rgba(16,185,129,.1); color: #065f46; }
.dept-clinics   { background: rgba(59,130,246,.1); color: #1e40af; }
.dept-admin     { background: rgba(100,116,139,.1);color: #374151; }
.dept-pharmacy  { background: rgba(245,158,11,.1); color: #92400e; }

/* ---------- Star Rating ---------- */
.stars { color: var(--accent); letter-spacing: 2px; font-size: 14px; }

/* ---------- Mobile Overlay ---------- */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 90;
  backdrop-filter: blur(2px);
}
.mobile-overlay.active { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .main-content { margin-right: var(--sidebar-collapsed); }
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .nav-badge,
  .sidebar .nav-section-label,
  .sidebar .toggle-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }
  .sidebar.mobile-open {
    width: var(--sidebar-width);
  }
  .sidebar.mobile-open .logo-text,
  .sidebar.mobile-open .nav-label,
  .sidebar.mobile-open .nav-badge,
  .sidebar.mobile-open .nav-section-label,
  .sidebar.mobile-open .toggle-text {
    opacity: 1;
    width: auto;
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .main-content { margin-right: 0; }
  .sidebar { right: -var(--sidebar-width); transform: translateX(100%); width: var(--sidebar-width) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .page-body { padding: 16px; }
  .top-header { padding: 0 16px; }
  .header-search { display: none; }
  .user-info { display: none; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .page-title { font-size: 16px; }
  .filter-bar { padding: 12px; }
  .tabs-nav { width: 100%; overflow-x: auto; }
}

@media (max-width: 480px) {
  .page-body { padding: 12px; }
  .stat-card { gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 18px; }
  .modal { margin: 10px; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .top-header, .header-actions, .btn { display: none !important; }
  .main-content { margin-right: 0 !important; }
  body { background: white; }
}

/* ---------- Utility Animations ---------- */
.fade-in { animation: fadeIn .4s ease forwards; }
.slide-up { animation: slideUp .4s cubic-bezier(.4,0,.2,1) forwards; }
.scale-in { animation: scaleIn .3s cubic-bezier(.4,0,.2,1) forwards; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  animation: slideUp .4s cubic-bezier(.4,0,.2,1) forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: .05s; }
.stagger-children > *:nth-child(2) { animation-delay: .10s; }
.stagger-children > *:nth-child(3) { animation-delay: .15s; }
.stagger-children > *:nth-child(4) { animation-delay: .20s; }
.stagger-children > *:nth-child(5) { animation-delay: .25s; }
.stagger-children > *:nth-child(6) { animation-delay: .30s; }
.stagger-children > *:nth-child(7) { animation-delay: .35s; }
.stagger-children > *:nth-child(8) { animation-delay: .40s; }

/* Pulse for alerts */
.alert-pulse { animation: alertPulse 2s infinite; }
@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,.0); }
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* AI thinking animation */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
}
.ai-thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: thinking .8s infinite alternate;
}
.ai-thinking-dot:nth-child(2) { animation-delay: .15s; }
.ai-thinking-dot:nth-child(3) { animation-delay: .30s; }
@keyframes thinking {
  from { transform: scale(.6); opacity: .4; }
  to   { transform: scale(1);  opacity: 1; }
}

/* ---------- Dark Mode Toggle Button ---------- */
.theme-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-600);
  font-size: 16px;
}
.theme-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ---------- Rank Badge ---------- */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
}

/* ---------- Quick Action Cards ---------- */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  text-decoration: none;
  color: var(--gray-700);
}
.quick-action:hover {
  border-color: var(--primary-light);
  background: rgba(26,58,92,.04);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  color: var(--primary);
}
.quick-action .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: var(--transition);
}
.quick-action:hover .qa-icon { transform: scale(1.1); }
.quick-action .qa-label { font-size: 12px; font-weight: 600; }

/* ---------- Prediction Cards ---------- */
.prediction-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}
.prediction-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.prediction-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

/* ---------- Activity Timeline Item ---------- */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
  padding: 24px;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(212,160,23,.08);
  top: -200px;
  right: -200px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  bottom: -150px;
  left: -100px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: scaleIn .4s cubic-bezier(.4,0,.2,1);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  text-align: center;
}
.login-logo .logo-shield {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(26,58,92,.35);
}
.login-logo h1 { font-size: 20px; font-weight: 800; color: var(--gray-900); margin: 0 0 4px; }
.login-logo p  { font-size: 12px; color: var(--gray-500); margin: 0; }
.login-form-group { margin-bottom: 18px; }
.login-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 7px;
}
.login-input-wrapper { position: relative; }
.login-input-wrapper .input-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
  pointer-events: none;
}
.login-input-wrapper input {
  width: 100%;
  padding: 11px 42px 11px 14px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  direction: rtl;
  transition: var(--transition);
  color: var(--gray-800);
}
.login-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,58,92,.1);
}
.login-input-wrapper .toggle-pass {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 14px;
  padding: 0;
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(26,58,92,.35); }
.login-btn:active { transform: translateY(0); }
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--gray-400);
  font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  line-height: 1.6;
}
.login-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ---------- Settings Page ---------- */
.settings-menu {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}
.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
}
.settings-menu-item:last-child { border-bottom: none; }
.settings-menu-item:hover { background: var(--gray-50); color: var(--primary); }
.settings-menu-item.active { background: rgba(26,58,92,.06); color: var(--primary); font-weight: 700; border-right: 3px solid var(--primary); }
.settings-menu-item .sm-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: fadeIn .25s ease; }
.settings-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-row-label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.settings-row-desc  { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 24px;
  transition: .3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  right: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(-20px); }

/* ---------- Profile Page ---------- */
.profile-cover {
  height: 180px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  overflow: hidden;
}
.profile-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.profile-avatar-wrap {
  position: absolute;
  bottom: -40px;
  right: 32px;
}
.profile-avatar-lg {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: white;
  border: 4px solid var(--white);
  box-shadow: var(--shadow-md);
}
.profile-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.profile-info-item { display: flex; flex-direction: column; gap: 4px; }
.profile-info-label { font-size: 11px; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.profile-info-value { font-size: 14px; color: var(--gray-800); font-weight: 600; }

/* ---------- Preview Modal (Action Previews) ---------- */
.preview-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.preview-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.preview-modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(.95) translateY(10px);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.preview-modal-overlay.open .preview-modal {
  transform: scale(1) translateY(0);
}
.preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}
.preview-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-modal-title .pm-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.preview-modal-close {
  width: 32px; height: 32px;
  background: var(--gray-100); border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--gray-500); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.preview-modal-close:hover { background: var(--danger); color: white; }
.preview-modal-body { padding: 24px; }
.preview-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.preview-detail-row:last-child { border-bottom: none; }
.preview-detail-row .pdr-label { color: var(--gray-500); font-weight: 500; }
.preview-detail-row .pdr-value { color: var(--gray-800); font-weight: 600; }
.action-result-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  gap: 14px;
  text-align: center;
}
.action-result-animation .result-icon {
  width: 70px; height: 70px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  animation: scaleIn .4s cubic-bezier(.4,0,.2,1);
}
.action-result-animation .result-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.action-result-animation .result-desc  { font-size: 13px; color: var(--gray-500); }
