/* ══════════════════════════════════════════
   ClientDAS — Design System
   Font: IBM Plex Sans Arabic + Inter
   Loaded via <link> in PHP headers
══════════════════════════════════════════ */

:root {
  /* Brand */
  --primary:        #1B3A6B;
  --primary-hover:  #15305A;
  --primary-light:  #EBF0FA;
  --primary-glow:   rgba(27,58,107,.15);

  --accent:         #2563EB;
  --accent-light:   #DBEAFE;

  --gold:           #C9A84C;
  --gold-light:     #FDF6E3;

  /* Status */
  --success:        #047857;
  --success-light:  #ECFDF5;
  --success-mid:    #D1FAE5;
  --warning:        #B45309;
  --warning-light:  #FFFBEB;
  --warning-mid:    #FDE68A;
  --danger:         #B91C1C;
  --danger-light:   #FEF2F2;
  --danger-mid:     #FECACA;
  --purple:         #6D28D9;
  --purple-light:   #F5F3FF;

  /* Neutral */
  --bg:             #F4F6FB;
  --bg-card:        #FFFFFF;
  --bg-dark:        #0F1928;
  --border:         #E4E9F2;
  --border-strong:  #C8D3E8;
  --text:           #0F1928;
  --text-secondary: #4A5568;
  --text-muted:     #8A97B0;
  --text-inv:       #F8FAFC;

  /* Layout */
  --sidebar-w:   270px;
  --header-h:    64px;

  /* Shape */
  --r-xs:  4px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;

  /* Shadow */
  --s-xs: 0 1px 2px rgba(15,25,40,.06);
  --s-sm: 0 2px 8px rgba(15,25,40,.08);
  --s-md: 0 4px 20px rgba(15,25,40,.08);
  --s-lg: 0 8px 32px rgba(15,25,40,.10);
  --s-xl: 0 20px 60px rgba(15,25,40,.15);

  --ease: 0.18s ease;
  --ease-md: 0.26s ease;
}

/* ══ Reset ══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body.rtl { direction: rtl; }
body.ltr { direction: ltr; font-family: 'Inter', 'IBM Plex Sans Arabic', sans-serif; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8D3E8; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #8A97B0; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg-dark);
}

.login-left {
  flex: 1;
  background: linear-gradient(145deg, #0F1928 0%, #1B3A6B 60%, #1E4DB7 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.25) 0%, transparent 65%);
  bottom: -200px; right: -150px;
}
.login-left::after {
  content: '';
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,.12) 0%, transparent 65%);
  top: -80px; left: -60px;
}
.login-left-content { position: relative; z-index: 1; max-width: 460px; }
.login-brand-wrap {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 48px;
}
.login-brand-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #3B82F6);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 24px rgba(37,99,235,.4);
  flex-shrink: 0;
}
.login-brand-name { font-size: 18px; font-weight: 800; color: #fff; }
.login-brand-sub  { font-size: 12px; color: rgba(255,255,255,.45); margin-top: 2px; }
.login-headline {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 16px;
}
.login-headline span { color: var(--gold); }
.login-sub { font-size: 14px; color: rgba(255,255,255,.55); line-height: 1.8; margin-bottom: 40px; }
.login-features { display: flex; flex-direction: column; gap: 14px; }
.login-feature {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: rgba(255,255,255,.7);
}
.login-feature-dot {
  width: 28px; height: 28px; flex-shrink: 0;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}

.login-right {
  width: 480px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 48px;
}
.login-form-wrap { width: 100%; max-width: 380px; }
.login-form-title { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.login-form-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }

.login-lang-row {
  display: flex; gap: 6px;
  background: var(--bg); padding: 5px; border-radius: 99px;
  margin-bottom: 28px; width: fit-content;
}
.ll-btn {
  padding: 5px 18px; border-radius: 99px;
  font-size: 12px; font-weight: 700;
  border: none; background: transparent; color: var(--text-muted);
  transition: all var(--ease);
}
.ll-btn.active { background: #fff; color: var(--primary); box-shadow: var(--s-sm); }

.field-wrap { margin-bottom: 20px; }
.field-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 7px;
}
.field-input-wrap { position: relative; }
.field-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 15px; pointer-events: none;
}
body.rtl .field-icon { right: 13px; }
body.ltr .field-icon { left: 13px; }
body.rtl .field-input-wrap input { padding-right: 42px; }
body.ltr .field-input-wrap input { padding-left: 42px; }

.btn-login {
  width: 100%; padding: 13px; font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; border-radius: var(--r-sm);
  box-shadow: 0 4px 18px var(--primary-glow);
  transition: all var(--ease); cursor: pointer; font-family: inherit;
  letter-spacing: .3px; margin-top: 8px;
}
.btn-login:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 24px var(--primary-glow); }

@media (max-width: 820px) {
  .login-left  { display: none; }
  .login-right { width: 100%; }
}

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-dark);
  position: fixed;
  top: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--ease-md);
}
body.ltr .sidebar { left: 0; right: auto; }
body.rtl .sidebar { right: 0; left: auto; }

.sb-top {
  padding: 22px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 18px;
}
.sb-brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #3B82F6);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37,99,235,.4);
}
.sb-brand-name { font-size: 14px; font-weight: 800; color: #F1F5F9; }
.sb-brand-sub  { font-size: 10px; color: #475569; }

.sb-user {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3B82F6);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sb-user-name { font-size: 12px; font-weight: 700; color: #E2E8F0; }
.sb-user-role {
  font-size: 10px; color: #64748B;
  background: rgba(255,255,255,.06);
  padding: 1px 8px; border-radius: 99px;
  display: inline-block; margin-top: 2px;
}

.sb-nav { flex: 1; padding: 8px 10px; }
.sb-section {
  font-size: 9px; font-weight: 800;
  color: #334155; text-transform: uppercase; letter-spacing: 1.3px;
  padding: 14px 10px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: #64748B; font-size: 13px; font-weight: 500;
  border: none; background: none; width: 100%;
  text-decoration: none; font-family: inherit;
  transition: all var(--ease); margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #CBD5E1; }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.nav-ic {
  width: 30px; height: 30px; border-radius: 7px;
  background: rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  transition: background var(--ease);
}
.nav-item.active .nav-ic { background: rgba(255,255,255,.18); }
.nav-item:hover:not(.active) .nav-ic { background: rgba(255,255,255,.11); }

.sb-lang {
  padding: 6px 10px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sb-lang-label { font-size: 9px; font-weight: 800; color: #334155; text-transform: uppercase; letter-spacing: 1.3px; padding: 10px 2px 6px; }
.lang-row { display: flex; gap: 3px; background: rgba(255,255,255,.05); border-radius: var(--r-sm); padding: 3px; }
.lang-btn {
  flex: 1; padding: 6px 4px; border-radius: 6px;
  font-size: 11px; font-weight: 700; border: none;
  background: transparent; color: #475569;
  transition: all var(--ease); font-family: inherit; text-align: center;
}
.lang-btn.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.lang-btn:hover:not(.active) { color: #94A3B8; background: rgba(255,255,255,.07); }

.sb-footer {
  padding: 8px 10px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
body.ltr .main-content { margin-left: var(--sidebar-w); }
body.rtl .main-content { margin-right: var(--sidebar-w); }

/* ── Topbar ── */
.topbar {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--s-xs);
}
.topbar-left  { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.topbar-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 14px 5px 8px; background: var(--bg);
  border-radius: 99px; border: 1px solid var(--border); font-size: 13px; font-weight: 500;
}
.topbar-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
}

.page-content { padding: 28px; flex: 1; }

/* ══════════════════════════════════════════
   STATS CARDS
══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--s-sm);
  display: flex; align-items: center; gap: 18px;
  transition: all var(--ease-md);
  position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--s-lg); }
.stat-card::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0; transition: opacity var(--ease-md);
}
.stat-card:hover::before { opacity: 1; }
.stat-card.blue::before  { background: linear-gradient(135deg, rgba(27,58,107,.03), transparent); }
.stat-card.green::before { background: linear-gradient(135deg, rgba(4,120,87,.03), transparent); }
.stat-card.red::before   { background: linear-gradient(135deg, rgba(185,28,28,.03), transparent); }
.stat-card.amber::before { background: linear-gradient(135deg, rgba(180,83,9,.03), transparent); }

.stat-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  opacity: 0; transition: opacity var(--ease-md);
}
.stat-card:hover::after { opacity: 1; }
.stat-card.blue::after  { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card.green::after { background: linear-gradient(90deg, #047857, #10B981); }
.stat-card.red::after   { background: linear-gradient(90deg, #B91C1C, #EF4444); }
.stat-card.amber::after { background: linear-gradient(90deg, #B45309, #F59E0B); }

.stat-icon {
  width: 52px; height: 52px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.stat-icon.blue  { background: linear-gradient(135deg, #EBF0FA, #DBEAFE); }
.stat-icon.green { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); }
.stat-icon.red   { background: linear-gradient(135deg, #FEF2F2, #FECACA); }
.stat-icon.amber { background: linear-gradient(135deg, #FFFBEB, #FDE68A); }
.stat-val   { font-size: 30px; font-weight: 900; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 5px; font-weight: 600; }

/* ══════════════════════════════════════════
   CARD COMPONENT
══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--s-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body { padding: 22px; }

/* ══════════════════════════════════════════
   CLIENT GRID
══════════════════════════════════════════ */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
.client-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  cursor: pointer;
  transition: all var(--ease-md);
  display: block;
  color: inherit;
  position: relative; overflow: hidden;
}
.client-card-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0); transform-origin: right; /* RTL */
  transition: transform var(--ease-md);
}
body.ltr .client-card-bar { transform-origin: left; }
.client-card:hover .client-card-bar { transform: scaleX(1); }
.client-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--s-lg);
  transform: translateY(-4px);
}
.client-card-av {
  width: 46px; height: 46px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
  border: 1px solid var(--border);
}
.client-card-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.client-card-meta { display: flex; flex-direction: column; gap: 5px; }
.client-meta-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); }
.client-card-foot {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 6px; flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-blue    { background: var(--primary-light); color: var(--primary); }
.badge-accent  { background: var(--accent-light); color: var(--accent); }
.badge-green   { background: var(--success-light); color: var(--success); }
.badge-red     { background: var(--danger-light); color: var(--danger); }
.badge-yellow  { background: var(--warning-light); color: var(--warning); }
.badge-purple  { background: var(--purple-light); color: var(--purple); }
.badge-gray    { background: #F1F5F9; color: var(--text-secondary); }
.badge-gold    { background: var(--gold-light); color: #92700A; }

.alert-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}
.alert-badge.red     { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-mid); }
.alert-badge.yellow  { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-mid); }
.alert-badge.green   { background: var(--success-light); color: var(--success); border: 1px solid var(--success-mid); }
.alert-badge.expired { background: var(--purple-light); color: var(--purple); border: 1px solid #DDD6FE; }

/* ══════════════════════════════════════════
   TABLE
══════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #F8FAFD;
  padding: 12px 16px;
  text-align: start;
  font-size: 11px; font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--ease); }
tbody tr:hover { background: #FAFBFE; }
tbody tr.alert-red     td { background: #FFF8F8; }
tbody tr.alert-yellow  td { background: #FFFDF5; }
tbody tr.alert-green   td { background: #F4FDF9; }
tbody tr.alert-expired td { background: #FDFAFF; }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-group  { margin-bottom: 18px; }
.form-label  { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.form-hint   { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px; background: var(--bg-card);
  color: var(--text); font-family: inherit; line-height: 1.5;
  transition: all var(--ease);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control   { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--ease); white-space: nowrap;
  font-family: inherit; line-height: 1; user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow); }

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

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(185,28,28,.2); }
.btn-danger:hover { background: #991B1B; transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 14px rgba(4,120,87,.2); }
.btn-success:hover { background: #065F46; transform: translateY(-1px); }

.btn-outline { background: transparent; color: var(--accent); border-color: #BFDBFE; }
.btn-outline:hover { background: var(--accent-light); }

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

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 10px; font-size: 11px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,25,40,.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease-md);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--s-xl);
  transform: translateY(20px) scale(.96);
  transition: transform .3s cubic-bezier(.34,1.3,.64,1);
  border: 1px solid var(--border);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 760px; }
.modal-sm { max-width: 400px; }

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: #FAFBFD;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); background: none; border: none;
  font-size: 18px; color: var(--text-muted); cursor: pointer;
  transition: all var(--ease);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body   { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: #FAFBFD;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tabs {
  display: flex; gap: 2px;
  background: #F1F5F9; padding: 4px;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  margin-bottom: 24px; flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 16px; border: none; background: transparent;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  cursor: pointer; border-radius: 6px;
  transition: all var(--ease); font-family: inherit; white-space: nowrap;
}
.tab-btn:hover:not(.active) { color: var(--text-secondary); background: rgba(255,255,255,.6); }
.tab-btn.active { background: var(--bg-card); color: var(--accent); box-shadow: var(--s-sm); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ══════════════════════════════════════════
   UPLOAD ZONE
══════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed #BFDBFE;
  border-radius: var(--r-lg); padding: 56px 40px;
  text-align: center; color: var(--text-muted);
  cursor: pointer; transition: all var(--ease); background: #FAFCFF;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light); color: var(--accent);
}
.upload-icon { font-size: 48px; margin-bottom: 14px; display: block; }
.upload-zone h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.upload-zone p  { font-size: 12px; }

/* ══════════════════════════════════════════
   ALERT BOXES
══════════════════════════════════════════ */
.alert-box {
  padding: 14px 18px; border-radius: var(--r-sm);
  margin-bottom: 14px; font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-box.info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.alert-box.success { background: var(--success-light); border-color: var(--success-mid); color: #065F46; }
.alert-box.warning { background: var(--warning-light); border-color: var(--warning-mid); color: #78350F; }
.alert-box.danger  { background: var(--danger-light); border-color: var(--danger-mid); color: #7F1D1D; }

/* ══════════════════════════════════════════
   TOOLBAR + SEARCH
══════════════════════════════════════════ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.search-input { min-width: 260px; }

/* ══════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════ */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.page-btn {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: var(--r-xs);
  background: var(--bg-card); cursor: pointer;
  font-size: 13px; font-weight: 600;
  transition: all var(--ease); font-family: inherit; color: var(--text-secondary);
}
.page-btn:hover { background: var(--accent-light); border-color: #BFDBFE; color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
#toast-container { position: fixed; bottom: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
body.rtl #toast-container { left: 24px; right: auto; }
body.ltr #toast-container { right: 24px; left: auto; }
.toast {
  background: var(--bg-dark); color: var(--text-inv);
  padding: 14px 20px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; max-width: 360px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--s-xl);
  border: 1px solid rgba(255,255,255,.08);
  animation: toastIn .26s cubic-bezier(.34,1.3,.64,1);
}
.toast.success { background: linear-gradient(135deg, #065F46, #047857); }
.toast.error   { background: linear-gradient(135deg, #7F1D1D, #B91C1C); }
.toast.warning { background: linear-gradient(135deg, #78350F, #B45309); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(.93); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══════════════════════════════════════════
   EDITABLE CELL
══════════════════════════════════════════ */
.editable-cell { cursor: pointer; transition: background var(--ease); }
.editable-cell:hover { background: var(--accent-light) !important; }
.editable-input {
  width: 100%; border: 2px solid var(--accent);
  border-radius: var(--r-xs); padding: 5px 10px;
  font-size: 13px; background: #fff; font-family: inherit;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ══════════════════════════════════════════
   BREADCRUMB
══════════════════════════════════════════ */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 20px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--accent); font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border-strong); font-size: 14px; }

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state { text-align: center; padding: 72px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 56px; margin-bottom: 18px; display: block; opacity: .6; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 280px; margin: 0 auto; }

/* ══════════════════════════════════════════
   PASSWORD
══════════════════════════════════════════ */
.password-cell  { display: flex; align-items: center; gap: 8px; }
.password-mask  { letter-spacing: 3px; font-size: 16px; color: var(--text-muted); }

/* ══════════════════════════════════════════
   COLUMN MANAGER
══════════════════════════════════════════ */
.col-row {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  margin-bottom: 8px; background: #F8FAFD;
  transition: all var(--ease);
}
.col-row:hover { border-color: #BFDBFE; background: var(--accent-light); }
.drag-handle { cursor: grab; color: var(--text-muted); padding: 2px 4px; font-size: 16px; }

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-110%);
    box-shadow: none;
  }
  body.rtl .sidebar { transform: translateX(110%); }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: var(--s-xl);
  }
  body.ltr .main-content,
  body.rtl .main-content { margin-left: 0 !important; margin-right: 0 !important; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .client-grid { grid-template-columns: 1fr; }
  #sidebar-toggle { display: flex !important; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .login-left { display: none; }
  .login-right { width: 100%; }
}

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

/* ══════════════════════════════════════════
   PRINT
══════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .btn, .toolbar, #toast-container { display: none !important; }
  body.ltr .main-content, body.rtl .main-content { margin: 0 !important; }
  .card { box-shadow: none; }
}
