:root {
  --primary: #0a2540;
  --primary-light: #143560;
  --accent: #00c8aa;
  --accent-2: #f7c948;
  --accent-3: #e84393;
  --bg: #040e1f;
  --bg-2: #071628;
  --bg-3: #0d2038;
  --surface: #0f2542;
  --surface-2: #132d4e;
  --surface-3: #1a3a60;
  --border: rgba(0,200,170,0.15);
  --border-2: rgba(0,200,170,0.3);
  --text-1: #e8f4ff;
  --text-2: #a0c4d8;
  --text-3: #5a8aaa;
  --danger: #ff4f6e;
  --success: #00c8aa;
  --warning: #f7c948;
  --info: #4fa3ff;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-accent: 0 0 24px rgba(0,200,170,0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideIn { from { opacity:0; transform:translateX(-30px); } to { opacity:1; transform:translateX(0); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }
@keyframes glow { 0%,100% { box-shadow: 0 0 20px rgba(0,200,170,0.3); } 50% { box-shadow: 0 0 40px rgba(0,200,170,0.6); } }
@keyframes float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-6px); } }
@keyframes countUp { from { opacity:0; transform:scale(0.7); } to { opacity:1; transform:scale(1); } }
@keyframes ripple { to { transform:scale(4); opacity:0; } }
@keyframes slideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }

.fade-in { animation: fadeIn 0.5s ease forwards; }
.slide-in { animation: slideIn 0.4s ease forwards; }

/* ===== LOADING SCREEN ===== */
#loading-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.loader-logo {
  font-family: 'Tajawal', sans-serif;
  font-size: 36px; font-weight: 900;
  color: var(--accent);
  animation: float 2s ease-in-out infinite;
  text-align: center;
}
.loader-logo span { color: var(--text-1); }
.loader-bar {
  width: 240px; height: 3px;
  background: var(--surface-3);
  border-radius: 99px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--info));
  border-radius: 99px;
  transition: width 0.1s ease;
}
.loader-text { font-size: 14px; color: var(--text-3); letter-spacing: 1px; }

/* ===== LOGIN PAGE ===== */
#login-page {
  min-height: 100vh;
  display: none; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
#login-page.active { display: flex; }
.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(0,200,170,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(79,163,255,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 60% 80%, rgba(232,67,147,0.06) 0%, transparent 50%);
}
.login-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(0,200,170,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,200,170,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}
.login-card {
  position: relative; z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 24px;
  padding: 44px 48px;
  width: 100%; max-width: 440px;
  animation: fadeIn 0.6s ease;
  box-shadow: var(--shadow), var(--shadow-accent);
}
.btn-block { width: 100%; margin-top: 4px; }
.login-header { text-align: center; margin-bottom: 36px; }
.login-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, rgba(0,200,170,0.2), rgba(79,163,255,0.2));
  border: 1px solid var(--border-2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  animation: glow 3s ease-in-out infinite;
}
.login-title { font-family: 'Tajawal', sans-serif; font-size: 26px; font-weight: 900; color: var(--text-1); }
.login-subtitle { font-size: 14px; color: var(--text-3); margin-top: 6px; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; font-weight: 600; }
.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  color: var(--text-1);
  outline: none;
  transition: var(--transition);
  direction: rtl;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,200,170,0.15); }
.form-input::placeholder { color: var(--text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px;
  border: none; border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative; overflow: hidden;
  text-decoration: none;
}
.btn::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.4s, opacity 0.4s;
}
.btn:active::after { transform: scale(4); opacity: 0; }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #009d85);
  color: var(--bg);
  box-shadow: 0 4px 20px rgba(0,200,170,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,200,170,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface-2); color: var(--text-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn-danger { background: rgba(255,79,110,0.15); color: var(--danger); border: 1px solid rgba(255,79,110,0.3); }
.btn-danger:hover { background: rgba(255,79,110,0.25); }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-xs); }

.alert {
  padding: 12px 16px; border-radius: var(--radius-xs);
  font-size: 13px; margin-bottom: 16px;
  animation: slideDown 0.3s ease;
}
.alert-error { background: rgba(255,79,110,0.15); border: 1px solid rgba(255,79,110,0.3); color: var(--danger); }
.alert-success { background: rgba(0,200,170,0.15); border: 1px solid rgba(0,200,170,0.3); color: var(--accent); }

/* ===== MAIN APP ===== */
#app { display: none; width: 100%; min-height: 100vh; }
#app.active { display: block; }

.app-layout {
  display: flex;
  flex-direction: row-reverse; /* RTL: sidebar on right, content on left */
  min-height: 100vh;
  width: 100%;
}

/* sidebar defined in PREMIUM SIDEBAR block */
/* sidebar-header */
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid var(--border); }

/* nav/sidebar-footer defined in PREMIUM SIDEBAR block below */

/* main-content layout */
.main-content {
  flex: 1;
  min-width: 0; /* prevent flex overflow */
  display: flex; flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}
.content-area { flex: 1; padding: 24px 28px; }

/* Appointments timeline */
.appt-list { display: flex; flex-direction: column; gap: 12px; }
.appt-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.appt-item:hover { border-color: var(--border-2); }
.appt-time {
  font-family: 'Tajawal', sans-serif;
  font-size: 15px; font-weight: 700;
  color: var(--accent); white-space: nowrap; min-width: 60px;
}
.appt-info { flex: 1; }
.appt-patient { font-size: 14px; font-weight: 700; }
.appt-doctor { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.appt-dept { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(79,163,255,0.1); color: var(--info); }

/* chart bars */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 8px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar {
  width: 100%; border-radius: 6px 6px 0 0;
  transition: height 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.bar-label { font-size: 10px; color: var(--text-3); white-space: nowrap; }
.bar-val { font-size: 11px; font-weight: 700; color: var(--text-2); }

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

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-text { font-size: 15px; }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-family: 'Tajawal', sans-serif; font-size: 22px; font-weight: 700; }
.section-subtitle { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ===== BREADCRUMB ===== */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.breadcrumb span { color: var(--text-2); }
.breadcrumb-sep { color: var(--text-3); }

/* ===== DOCTOR CARD ===== */
.doctors-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.doctor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; text-align: center;
  transition: var(--transition);
}
.doctor-card:hover { border-color: var(--border-2); transform: translateY(-4px); box-shadow: var(--shadow); }
.doctor-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,200,170,0.3), rgba(79,163,255,0.3));
  border: 2px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: var(--accent);
  margin: 0 auto 16px;
  font-family: 'Tajawal', sans-serif;
}
.doctor-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.doctor-spec { font-size: 12px; color: var(--info); margin-bottom: 12px; }
.doctor-stats { display: flex; justify-content: center; gap: 20px; margin-bottom: 16px; }
.doctor-stat { text-align: center; }
.doctor-stat-val { font-size: 16px; font-weight: 700; font-family: 'Tajawal', sans-serif; }
.doctor-stat-lbl { font-size: 10px; color: var(--text-3); }

/* ===== PATIENT PROFILE ===== */
.patient-profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 20px;
}
.patient-profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--info), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; color: var(--bg);
  flex-shrink: 0;
  font-family: 'Tajawal', sans-serif;
}
.patient-profile-info { flex: 1; }
.patient-profile-name { font-size: 22px; font-weight: 700; font-family: 'Tajawal', sans-serif; }
.patient-profile-meta { display: flex; gap: 20px; margin-top: 8px; }
.patient-profile-meta-item { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; background: var(--bg-3); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px; }
.tab {
  flex: 1; padding: 10px; text-align: center;
  font-size: 13px; font-weight: 600;
  color: var(--text-3); cursor: pointer;
  border-radius: 8px; transition: var(--transition);
}
.tab.active { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow); }

/* ===== NOTIFICATIONS ===== */
.toast-container { position: fixed; bottom: 24px; left: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  min-width: 280px;
  box-shadow: var(--shadow), var(--shadow-accent);
  animation: slideIn 0.3s ease;
  font-size: 14px;
}
.toast-success { border-color: rgba(0,200,170,0.4); }
.toast-error { border-color: rgba(255,79,110,0.4); }
.toast-icon { font-size: 18px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .doctors-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { width: 220px; }
}
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { min-height: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .widgets-grid { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }
}

/* ===== MISC ===== */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-3); }
.font-bold { font-weight: 700; }
.mt-16 { margin-top: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.info-item { background: var(--bg-3); border-radius: var(--radius-sm); padding: 14px; }
.info-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.info-value { font-size: 14px; font-weight: 600; }

.accounts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}
.account-card:hover { border-color: var(--border-2); }
.account-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.account-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; font-family: 'Tajawal', sans-serif;
  flex-shrink: 0;
}
.account-name { font-size: 15px; font-weight: 700; }
.account-role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; margin-top: 4px;
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0; left: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,200,170,0.1);
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  animation: slideDown 0.18s ease;
}
.autocomplete-dropdown.active { display: block; }
.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--surface-3); }
.ac-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.ac-phone { font-size: 12px; color: var(--text-3); direction: ltr; }
.ac-empty { padding: 14px 16px; font-size: 13px; color: var(--text-3); text-align: center; }

/* ===== ENHANCED FORM CONTROLS ===== */
.form-control {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  color: var(--text-1);
  outline: none;
  transition: var(--transition);
  direction: rtl;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,200,170,0.12), 0 2px 12px rgba(0,200,170,0.08);
  background: var(--surface);
}
.form-control::placeholder { color: var(--text-3); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a8aaa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 40px;
}

/* ===== ELEVATED MODAL ===== */
.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,200,170,0.08), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: fadeIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(4,14,31,0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(0,200,170,0.05), transparent);
}
.modal-title { font-family: 'Tajawal', sans-serif; font-size: 18px; font-weight: 700; }
.modal-close {
  width: 34px; height: 34px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-3);
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(255,79,110,0.15); color: var(--danger); border-color: rgba(255,79,110,0.3); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-2);
  border-radius: 0 0 20px 20px;
}

/* ===== PREMIUM TOPBAR ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--text-1), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topbar-date { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ===== PREMIUM STAT CARDS ===== */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.accent::before { background: linear-gradient(90deg, var(--accent), transparent); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), transparent); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), transparent); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), transparent); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-2); }
.stat-icon { font-size: 28px; margin-bottom: 12px; }
.stat-value {
  font-family: 'Tajawal', sans-serif;
  font-size: 36px; font-weight: 900;
  line-height: 1;
  animation: countUp 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.info .stat-value { color: var(--info); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-label { font-size: 13px; color: var(--text-3); margin-top: 6px; font-weight: 500; }

/* ===== PREMIUM SIDEBAR ===== */
.sidebar {
  width: 268px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-header { padding: 26px 22px; border-bottom: 1px solid var(--border); }
.sidebar-logo {
  font-family: 'Tajawal', sans-serif;
  font-size: 19px; font-weight: 900;
  color: var(--accent);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, rgba(0,200,170,0.25), rgba(79,163,255,0.25));
  border: 1px solid var(--border-2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 16px rgba(0,200,170,0.2);
}
.sidebar-logo-text { color: var(--text-1); }
.sidebar-logo-sub { font-size: 11px; color: var(--text-3); font-weight: 400; }
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.sidebar-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--info));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  color: var(--bg);
  font-family: 'Tajawal', sans-serif;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0,200,170,0.3);
}
.sidebar-username { font-size: 13px; font-weight: 700; }
.sidebar-role { font-size: 11px; color: var(--accent); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-3); letter-spacing: 1.5px;
  text-transform: uppercase; padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(0,200,170,0.15), rgba(79,163,255,0.08));
  color: var(--accent);
  border: 1px solid rgba(0,200,170,0.2);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 99px;
  box-shadow: 0 0 8px rgba(0,200,170,0.5);
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white; font-size: 10px; font-weight: 800;
  padding: 2px 7px; border-radius: 99px;
  min-width: 20px; text-align: center;
  animation: pulse 2s infinite;
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

/* ===== DB TOOLBAR ENHANCED ===== */
.db-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ===== WIDGET ENHANCED ===== */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: var(--transition);
}
.widget:hover { border-color: var(--border-2); }
.widget-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 15px; font-weight: 700;
  color: var(--text-1); margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ===== TABLE PREMIUM ===== */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table thead tr {
  background: linear-gradient(135deg, var(--bg-3), var(--surface));
  border-bottom: 1px solid var(--border-2);
}
.table th {
  padding: 14px 16px;
  font-size: 11px; font-weight: 700;
  color: var(--text-3); letter-spacing: 0.8px;
  text-align: right; white-space: nowrap;
  text-transform: uppercase;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: rgba(0,200,170,0.04); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGE PREMIUM ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-success { background: rgba(0,200,170,0.15); color: var(--accent); border: 1px solid rgba(0,200,170,0.25); }
.badge-danger  { background: rgba(255,79,110,0.15); color: var(--danger); border: 1px solid rgba(255,79,110,0.25); }
.badge-warning { background: rgba(247,201,72,0.15); color: var(--warning); border: 1px solid rgba(247,201,72,0.25); }
.badge-info    { background: rgba(79,163,255,0.15); color: var(--info); border: 1px solid rgba(79,163,255,0.25); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* ===== PREMIUM BTN ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #009d85 100%);
  color: var(--bg);
  box-shadow: 0 4px 16px rgba(0,200,170,0.35);
  font-weight: 800;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,200,170,0.45); }

/* ===== LOGIN CARD PREMIUM ===== */
.login-logo {
  font-size: 48px;
  text-align: center; margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(0,200,170,0.4));
}
.login-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 28px; font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, var(--text-1), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-subtitle { text-align: center; font-size: 14px; color: var(--text-3); margin-bottom: 32px; margin-top: 4px; }
.login-hint {
  margin-top: 20px; padding: 14px;
  background: rgba(0,200,170,0.07);
  border: 1px solid rgba(0,200,170,0.2);
  border-radius: var(--radius-xs);
  font-size: 12px; color: var(--text-3);
  text-align: center; line-height: 1.8;
}
.login-hint strong { color: var(--accent); }

/* ===== PAGE TRANSITIONS ===== */
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}

/* ===== FORM GRID ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.widgets-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }

/* ===== WEEK CHART ===== */
.week-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: 16px; }

  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.db-toolbar-label {
  font-size: 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.db-toolbar-label .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
.db-toolbar-label .dot.saving {
  background: var(--warning);
}
.db-toolbar-spacer { flex: 1; }
.btn-db { 
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; border: none;
  font-family: 'Cairo', sans-serif; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-export { background: rgba(0,200,170,0.15); color: var(--accent); }
.btn-export:hover { background: rgba(0,200,170,0.3); }
.btn-import { background: rgba(79,163,255,0.15); color: var(--info); }
.btn-import:hover { background: rgba(79,163,255,0.3); }
.btn-reset { background: rgba(255,79,110,0.15); color: var(--danger); }
.btn-reset:hover { background: rgba(255,79,110,0.3); }
#import-file-input { display: none; }
