/* ══════════════════════════════════════════
   RCMS — Design System
   Based on ClientDAS / Moral HR identity
   Font: IBM Plex Sans Arabic + Inter
══════════════════════════════════════════ */

:root {
  --primary:        #8E1D58;
  --primary-hover:  #6e1544;
  --primary-light:  #f7eaf2;
  --primary-glow:   rgba(142,29,88,.15);

  --accent:         #8E1D58;
  --accent-light:   #f7eaf2;

  --gold:           #C1BC4C;
  --gold-light:     #FDF6E3;

  --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;

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

  --sidebar-w:   270px;
  --header-h:    64px;

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

  --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; }
code { font-family: 'Courier New', monospace; font-size: 0.9em; background: var(--bg-muted); padding: 2px 6px; border-radius: 4px; }
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, #1a0a10 0%, #4a0d2a 45%, #8E1D58 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(142,29,88,.30) 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-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;
}
.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 {
  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-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(--primary), #b8256e);
  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(142,29,88,.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: 14px; }
.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;
}
.topbar-bell {
  position: relative; font-size: 18px;
  padding: 4px; cursor: pointer;
}
.bell-badge {
  position: absolute; top: -2px; right: -4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

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

/* ── Search ── */
.search-wrap { position: relative; }
.search-input {
  width: 240px; padding: 7px 14px;
  border: 1.5px solid var(--border); border-radius: 99px;
  font-size: 13px; background: var(--bg);
  color: var(--text); font-family: inherit;
  transition: all var(--ease);
}
.search-input:focus { outline: none; border-color: var(--accent); background: #fff; width: 320px; box-shadow: 0 0 0 3px rgba(142,29,88,.08); }
.search-dropdown {
  position: absolute; top: calc(100% + 6px);
  width: 380px; max-height: 400px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--s-lg); z-index: 300;
}
body.rtl .search-dropdown { right: 0; }
body.ltr .search-dropdown { left: 0; }
.search-group-label {
  padding: 10px 16px 4px; font-size: 10px; font-weight: 800;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px;
}
.search-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 16px; transition: background var(--ease); cursor: pointer;
}
.search-item:hover { background: var(--bg); }
.search-name { font-size: 13px; font-weight: 500; }
.search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ══════════════════════════════════════════
   STATS CARDS
══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg); padding: 20px;
  border: 1px solid var(--border); box-shadow: var(--s-sm);
  display: flex; align-items: center; gap: 16px;
  transition: all var(--ease-md);
  position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--s-lg); }
.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-card.purple::after { background: linear-gradient(90deg, #6D28D9, #8B5CF6); }
.stat-card.gold::after   { background: linear-gradient(90deg, #92700A, var(--gold)); }

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; 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-icon.purple { background: linear-gradient(135deg, #F5F3FF, #DDD6FE); }
.stat-icon.gold   { background: linear-gradient(135deg, var(--gold-light), #EDE9B0); }

.stat-val   { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 600; }
.stat-trend { font-size: 11px; font-weight: 700; margin-top: 2px; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ══════════════════════════════════════════
   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; }

/* ══════════════════════════════════════════
   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; }

/* ══════════════════════════════════════════
   TABLE
══════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
.table-wrapper::-webkit-scrollbar        { height: 10px; }
.table-wrapper::-webkit-scrollbar-track  { background: var(--border); border-radius: 10px; }
.table-wrapper::-webkit-scrollbar-thumb  { background: var(--primary); border-radius: 10px; border: 2px solid var(--border); }

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; }

/* ══════════════════════════════════════════
   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(142,29,88,.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: var(--primary-light); }
.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-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--bg); font-size: 18px;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
body.rtl #toast-container { left: 20px; right: auto; }
body.ltr #toast-container { right: 20px; left: auto; }

.toast {
  padding: 12px 20px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--s-lg); min-width: 280px;
  transform: translateX(120%); transition: transform .3s ease;
}
body.rtl .toast { transform: translateX(-120%); }
.toast.show { transform: translateX(0); }
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-info    { background: #1E3A8A; color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast-icon    { font-size: 16px; }

/* ══════════════════════════════════════════
   ALERT BOX
══════════════════════════════════════════ */
.alert-box {
  padding: 14px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.alert-box.danger  { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-mid); }
.alert-box.warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-mid); }
.alert-box.success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-mid); }
.alert-box.info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .6; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-hint  { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; max-width: 400px; margin-inline: auto; }

/* ══════════════════════════════════════════
   SKELETON LOADING
══════════════════════════════════════════ */
.skeleton-row {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.skeleton-line {
  height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, #E4E9F2 25%, #F0F3F8 50%, #E4E9F2 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════
   TIMELINE
══════════════════════════════════════════ */
.timeline { position: relative; padding: 0; }
.timeline::before {
  content: ''; position: absolute; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
body.rtl .timeline::before { right: 16px; }
body.ltr .timeline::before { left: 16px; }

.timeline-item {
  position: relative; padding: 0 0 24px;
  display: flex; gap: 16px;
}
body.rtl .timeline-item { padding-right: 44px; }
body.ltr .timeline-item { padding-left: 44px; }

.timeline-dot {
  position: absolute; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--primary); background: #fff;
}
body.rtl .timeline-dot { right: 11px; }
body.ltr .timeline-dot { left: 11px; }

.timeline-dot.note          { border-color: #3B82F6; }
.timeline-dot.status_change { border-color: var(--primary); }
.timeline-dot.email         { border-color: var(--success); }
.timeline-dot.alert         { border-color: var(--warning); }

.timeline-content {
  flex: 1; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 12px 16px;
}
.timeline-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 6px;
  display: flex; gap: 12px;
}

/* ══════════════════════════════════════════
   DASHBOARD GRID
══════════════════════════════════════════ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px; margin-top: 24px;
}
.dash-grid .card.full-width { grid-column: 1 / -1; }

/* ══════════════════════════════════════════
   FUNNEL
══════════════════════════════════════════ */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--bg); position: relative;
}
.funnel-bar {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .6s ease;
}
.funnel-label { font-size: 12px; font-weight: 600; min-width: 120px; }
.funnel-count { font-size: 14px; font-weight: 800; min-width: 40px; text-align: center; }
.funnel-rate  { font-size: 11px; color: var(--text-muted); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.rcms-footer {
  padding: 16px 28px; text-align: center;
  font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.footer-logo { height: 16px; opacity: .5; }

/* ══════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 800; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════ */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center;
}
.filter-bar select,
.filter-bar input {
  padding: 7px 12px; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); font-size: 13px; font-family: inherit;
  background: var(--bg-card); color: var(--text);
}
.filter-bar select:focus,
.filter-bar input:focus { outline: none; border-color: var(--accent); }

/* ══════════════════════════════════════════
   ADMIN: COMPANY CARDS
══════════════════════════════════════════ */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.company-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
  transition: all var(--ease-md); position: relative; overflow: hidden;
}
.company-card:hover { border-color: var(--border-strong); box-shadow: var(--s-lg); transform: translateY(-3px); }
.company-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;
  transition: transform var(--ease-md);
}
body.ltr .company-card-bar { transform-origin: left; }
.company-card:hover .company-card-bar { transform: scaleX(1); }
.company-card-name { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.company-card-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }
.company-card-foot {
  padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ══════════════════════════════════════════
   PUBLIC STATUS PAGE
══════════════════════════════════════════ */
.status-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.status-card {
  background: var(--bg-card); border-radius: var(--r-xl);
  border: 1px solid var(--border); box-shadow: var(--s-lg);
  padding: 40px; max-width: 480px; width: 100%; text-align: center;
}
.status-logo { height: 40px; margin: 0 auto 24px; }
.status-name { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.status-job  { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.status-badge-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 99px;
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
}
.status-message { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.status-date { font-size: 12px; color: var(--text-muted); }
.trust-badge {
  margin-top: 20px; padding: 10px 16px;
  background: var(--success-light); border: 1px solid var(--success-mid);
  border-radius: var(--r-sm); font-size: 12px; color: var(--success); font-weight: 600;
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
══════════════════════════════════════════ */
@media (max-width: 767px) {
  .sidebar { transform: translateX(100%); }
  body.ltr .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0 !important; margin-right: 0 !important; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .search-input { width: 140px; }
  .search-input:focus { width: 200px; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-header h1 { font-size: 18px; }

  /* Table → Cards */
  .mobile-cards { display: flex; flex-direction: column; gap: 10px; }
  .mobile-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 16px;
  }
  .mobile-card-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 13px;
  }
  .mobile-card-label { color: var(--text-muted); font-weight: 600; font-size: 11px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
