/* =====================================================
   نظام شڤيار - CSS الاحترافي
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --teal: #0f9da4;
  --teal-light: #14b8bf;
  --teal-dark: #0c7e84;
  --teal-glass: rgba(15, 157, 164, 0.12);
  --teal-glow: rgba(15, 157, 164, 0.25);

  --bg-main: #f0f4f8;
  --bg-card: #ffffff;
  --bg-navbar: #ffffff;
  --bg-sidebar: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-nav: #374151;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --font-size-base: 95%;
}

/* Dark Mode */
.dark-mode {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-navbar: #1e293b;
  --bg-sidebar: #1e293b;
  --border: #334155;
  --border-light: #2d3748;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-nav: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3);
}

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

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===========================
   LOGIN PAGE
   =========================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f8f9 0%, #d1f0f2 30%, #e0f2f1 60%, #f0fffe 100%);
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

.dark-mode .login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1a2744 40%, #0f2537 100%);
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: float 8s ease-in-out infinite;
}

.blob-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #0f9da4, transparent);
  top: -100px; left: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #14b8bf, transparent);
  bottom: -80px; right: -80px;
  animation-delay: 3s;
}

.blob-3 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, #6ee7b7, transparent);
  top: 40%; left: 60%;
  animation-delay: 5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.login-card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.7);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s cubic-bezier(0.16,1,0.3,1);
}

.dark-mode .login-card {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(51, 65, 85, 0.8);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}

.logo-icon-wrap {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, #0f9da4, #14c5cd);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(15,157,164,0.35);
  font-size: 1.8rem;
  color: white;
  animation: pulse-logo 3s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%, 100% { box-shadow: 0 8px 24px rgba(15,157,164,0.35); }
  50% { box-shadow: 0 8px 32px rgba(15,157,164,0.55); }
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  position: relative;
}

.login-input {
  width: 100%;
  padding: 0.8rem 2.8rem 0.8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition);
  direction: rtl;
}

.login-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.input-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.toggle-pass {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.toggle-pass:hover { color: var(--teal); }

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dark-mode .login-error {
  background: rgba(220,38,38,0.1);
  border-color: rgba(220,38,38,0.3);
}

.login-btn {
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(15,157,164,0.4);
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(15,157,164,0.5); }
.login-btn:hover::before { opacity: 1; }
.login-btn:active { transform: translateY(0); }

.login-hint {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, rgba(15,157,164,0.08), rgba(15,157,164,0.04));
  border: 1px solid rgba(15,157,164,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  direction: rtl;
}

.login-hint i { color: var(--teal); }
.login-hint strong { color: var(--teal); }

.login-footer {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

/* ===========================
   MAIN APP LAYOUT
   =========================== */
.main-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===========================
   TOP NAVBAR
   =========================== */
.top-navbar {
  height: 56px;
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-back-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.95rem;
}

.navbar-back-btn:hover {
  background: var(--teal-glass);
  border-color: var(--teal);
  color: var(--teal);
  transform: translateX(3px);
}

.navbar-logo-img {
  max-height: 38px;
  width: auto;
  object-fit: contain;
  transition: var(--transition-fast);
}

.navbar-logo-img:hover {
  transform: scale(1.03);
}

.navbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-center .page-title {
  font-size: 1.25rem;
  font-weight: 750;
  color: var(--teal);
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--teal), #0c7e84);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 0.2rem 0.5rem;
  border-bottom: 2.5px solid var(--teal);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition-fast);
}

.navbar-btn:hover {
  background: var(--teal-glass);
  border-color: var(--teal);
  color: var(--teal);
}

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 18px; height: 18px;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-navbar);
}

.user-menu-btn {
  height: 38px;
  padding: 0 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-nav);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.user-menu-btn:hover {
  background: var(--teal-glass);
  border-color: var(--teal);
  color: var(--teal);
}

.user-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.user-chevron.open { transform: rotate(180deg); }

/* USER DROPDOWN */
.user-menu-wrap { position: relative; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  animation: dropDown 0.2s cubic-bezier(0.16,1,0.3,1);
}

@keyframes dropDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background: linear-gradient(135deg, var(--teal-glass), transparent);
}

.user-avatar-lg {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.user-dd-name { font-weight: 700; font-size: 0.95rem; }
.user-dd-role { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

.user-dd-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: right;
  transition: var(--transition-fast);
}

.user-dd-item:hover {
  background: var(--teal-glass);
  color: var(--teal);
}

.user-dd-item i { width: 16px; text-align: center; color: var(--text-muted); }
.user-dd-item:hover i { color: var(--teal); }

.logout-item { color: #ef4444 !important; }
.logout-item i { color: #ef4444 !important; }
.logout-item:hover { background: rgba(239,68,68,0.08) !important; }

.font-size-control,
.screen-size-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.font-size-control i,
.screen-size-control i { color: var(--text-muted); }

.font-btns {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: auto;
}

.font-btns button {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.font-btns button:hover { background: var(--teal); color: white; border-color: var(--teal); }
.font-btns span { font-size: 0.78rem; font-weight: 600; min-width: 32px; text-align: center; }

.fullscreen-control {
  display: flex;
  align-items: center;
}

.full-width-item { flex: 1; justify-content: flex-start; }

/* NOTIFICATIONS PANEL */
.notif-panel {
  position: fixed;
  top: 64px;
  left: 1rem;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  animation: dropDown 0.2s cubic-bezier(0.16,1,0.3,1);
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
}

.mark-read-btn {
  font-size: 0.75rem;
  color: var(--teal);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
}

.notif-list { max-height: 300px; overflow-y: auto; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.notif-item.unread { background: rgba(15,157,164,0.04); }
.notif-item:hover { background: var(--bg-main); }

.notif-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: white;
}

.notif-icon.blue { background: #3b82f6; }
.notif-icon.green { background: #10b981; }
.notif-icon.orange { background: #f59e0b; }
.notif-icon.gray { background: #94a3b8; }

.notif-msg { font-size: 0.85rem; font-weight: 500; }
.notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ===========================
   APP CONTENT
   =========================== */
.app-content {
  flex: 1;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}



/* PAGE */
.page { display: none; animation: pageIn 0.3s ease; }
.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  display: inline-block;
}

.page-header-line {
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  border-radius: 2px;
  margin: 0.5rem auto 0;
}

/* ===========================
   DASHBOARD
   =========================== */
.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.view-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.toolbar-left { display: flex; gap: 0.5rem; }

.tool-btn {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.tool-btn.active,
.tool-btn:hover {
  background: var(--teal-glass);
  border-color: var(--teal);
  color: var(--teal);
}

/* Sort mode buttons */
.tool-btn-save {
  background: linear-gradient(135deg, #10b981, #34d399) !important;
  border-color: #10b981 !important;
  color: white !important;
}
.tool-btn-save:hover {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: white !important;
}

.tool-btn-cancel {
  background: linear-gradient(135deg, #ef4444, #f87171) !important;
  border-color: #ef4444 !important;
  color: white !important;
}
.tool-btn-cancel:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  color: white !important;
}

/* ---- SORT MODE STYLES ---- */
.modules-grid.sort-mode .module-card {
  cursor: grab;
  border: 2px dashed var(--teal) !important;
  border-radius: var(--radius-md);
  position: relative;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  user-select: none;
}

.modules-grid.sort-mode .module-card::after {
  content: '\f0b2';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.75rem;
  color: var(--teal);
  opacity: 0.7;
}

.modules-grid.sort-mode .module-card:hover {
  box-shadow: 0 6px 20px rgba(15,157,164,0.2);
  border-color: var(--teal-light) !important;
}

.modules-grid.sort-mode .module-card:active {
  cursor: grabbing;
}

.module-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  border: 2px dashed #94a3b8 !important;
}

.module-card.drag-over {
  border-color: var(--teal-light) !important;
  background: linear-gradient(135deg, rgba(15,157,164,0.12), rgba(15,157,164,0.04)) !important;
  transform: scale(1.03);
  box-shadow: 0 8px 25px rgba(15,157,164,0.25) !important;
}

/* MODULE CARDS */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.module-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--teal-glass), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.module-card:hover {
  border-color: var(--teal);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(15,157,164,0.15);
}

.module-card:hover::before { opacity: 1; }

.module-card:active { transform: translateY(-1px); }

.module-icon-wrap {
  width: 60px; height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.module-icon-wrap.teal {
  background: rgba(15,157,164,0.1);
  color: var(--teal);
  border: 1px solid rgba(15,157,164,0.2);
}

.module-card:hover .module-icon-wrap.teal {
  background: var(--teal);
  color: white;
  box-shadow: 0 4px 15px rgba(15,157,164,0.35);
}

.module-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  position: relative;
  z-index: 1;
}

/* STATS */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

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

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

.stat-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ===========================
   PAGE ACTIONS
   =========================== */
.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.btn-primary-act {
  padding: 0.55rem 1.2rem;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(15,157,164,0.3);
}

.btn-primary-act:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(15,157,164,0.4);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-wrap i {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-input {
  width: 100%;
  padding: 0.55rem 2.2rem 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  transition: var(--transition-fast);
  direction: rtl;
}

.search-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.filter-btns {
  display: flex;
  gap: 0.4rem;
}

.filter-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn.active,
.filter-btn:hover { background: var(--teal); color: white; border-color: var(--teal); }

/* ===========================
   TABLES
   =========================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead {
  background: linear-gradient(135deg, rgba(15,157,164,0.06), rgba(15,157,164,0.02));
  border-bottom: 2px solid var(--border);
}

.data-table th {
  padding: 0.9rem 1rem;
  text-align: right;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover { background: rgba(15,157,164,0.03); }

.data-table td {
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  vertical-align: middle;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-active { background: rgba(16,185,129,0.12); color: #059669; }
.badge-pending { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-danger { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-warning { background: rgba(251,191,36,0.12); color: #92400e; }
.badge-purple { background: rgba(139,92,246,0.12); color: #7c3aed; }
.badge-blue { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.badge-orange { background: rgba(249,115,22,0.12); color: #c2410c; }

/* ACTIONS */
.actions-cell { white-space: nowrap; }

.act-btn {
  width: 30px; height: 30px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition-fast);
  margin-left: 0.25rem;
}

.act-btn.view { background: rgba(59,130,246,0.1); color: #3b82f6; }
.act-btn.view:hover { background: #3b82f6; color: white; }
.act-btn.edit { background: rgba(15,157,164,0.1); color: var(--teal); }
.act-btn.edit:hover { background: var(--teal); color: white; }
.act-btn.delete { background: rgba(239,68,68,0.1); color: #ef4444; }
.act-btn.delete:hover { background: #ef4444; color: white; }

/* EMP NAME */
.emp-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.emp-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* TEXT COLORS */
.text-green { color: #059669; font-weight: 700; }
.text-red { color: #dc2626; font-weight: 700; }

/* ===========================
   BALANCE PAGE
   =========================== */
.balance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0;
}

.balance-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.balance-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

.balance-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.balance-card.red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.balance-card.blue::before { background: linear-gradient(90deg, var(--teal), var(--teal-light)); }

.balance-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.balance-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.2rem;
}

.balance-card.green .balance-icon { background: rgba(16,185,129,0.1); color: #10b981; }
.balance-card.red .balance-icon { background: rgba(239,68,68,0.1); color: #ef4444; }
.balance-card.blue .balance-icon { background: var(--teal-glass); color: var(--teal); }

.balance-amount {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  direction: ltr;
}

.balance-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

/* ===========================
   PROFIT PAGE
   =========================== */
.profit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.profit-card.highlight {
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(15,157,164,0.05), var(--bg-card));
}

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

.profit-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

.profit-amount {
  font-size: 1.3rem;
  font-weight: 800;
  direction: ltr;
}

.profit-amount.green { color: #059669; }
.profit-amount.red { color: #dc2626; }
.profit-amount.teal { color: var(--teal); }

.profit-trend {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.profit-trend.up { color: #059669; }
.profit-trend.down { color: #dc2626; }

/* BAR CHART */
.chart-section { margin-top: 1rem; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.bar-chart-container {
  padding: 1rem 0;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  height: 150px;
  padding: 0 1rem;
  border-bottom: 2px solid var(--border);
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.bar {
  width: 100%;
  max-width: 60px;
  height: var(--h);
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: opacity 0.2s;
  position: relative;
}

.bar:hover { opacity: 0.85; }

.bar-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

/* ===========================
   PROFILE
   =========================== */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--teal-glass);
  border-radius: var(--radius-md);
}

.profile-avatar {
  width: 100px; height: 100px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  box-shadow: 0 8px 24px rgba(15,157,164,0.3);
}

.profile-name { font-size: 1.1rem; font-weight: 800; text-align: center; }
.profile-role { font-size: 0.82rem; color: var(--text-secondary); text-align: center; }

/* ===========================
   FORMS
   =========================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  direction: rtl;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
  background: var(--bg-card);
}

textarea.form-input { resize: vertical; min-height: 80px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ===========================
   MODALS
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  animation: modalIn 0.3s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid var(--border);
}

.modal-box.small { max-width: 400px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--teal-glass), transparent);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header h3 i { color: var(--teal); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-main);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.modal-close:hover { background: #ef4444; color: white; }

.modal-body {
  padding: 1.5rem;
}

.modal-body.center-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.about-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  margin-bottom: 0.5rem;
}

.about-divider { width: 100%; border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }
.about-copy { font-size: 0.8rem; color: var(--text-muted); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
}

.btn-cancel {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-cancel:hover { background: var(--bg-main); border-color: var(--text-secondary); }

.btn-save {
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: white;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(15,157,164,0.3);
}

.btn-save:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,157,164,0.4); }
.btn-save.full-w { width: 100%; justify-content: center; }

/* ===========================
   TOAST
   =========================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  min-width: 250px;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-20px); }
}

.toast.success { background: linear-gradient(135deg, #10b981, #34d399); }
.toast.error { background: linear-gradient(135deg, #ef4444, #f87171); }
.toast.info { background: linear-gradient(135deg, var(--teal), var(--teal-light)); }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  .app-content { padding: 1rem; }
  .modules-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .profile-card { grid-template-columns: 1fr; }
  .balance-summary { grid-template-columns: 1fr; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.5rem; }
  .top-navbar { padding: 0 1rem; }
  .user-menu-btn span { display: none; }
  .notif-panel { width: calc(100vw - 2rem); left: 1rem; }
}

@media (max-width: 480px) {
  .modules-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: 1fr; }
  .section-title { font-size: 1.4rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal); }
