/* ==========================================================================
   RAF Enterprise Management System — Design System
   Brand: Taupe Bronze #8F7961 · Gold #A68C6D · Charcoal #1E1E1E
   RTL, Arabic-first, Enterprise, Modern
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand */
  --brand-bronze: #8F7961;
  --brand-bronze-600: #7a6552;
  --brand-bronze-700: #614f40;
  --brand-gold: #A68C6D;
  --brand-gold-light: #C4AB89;

  /* Neutrals */
  --neutral-900: #1E1E1E;
  --neutral-800: #252525;
  --neutral-700: #3a3a3a;
  --neutral-600: #6b7280;
  --neutral-400: #a3a3a3;
  --neutral-300: #d4d4d4;
  --neutral-200: #e7e5e0;
  --neutral-100: #F0EDE6;
  --off-white: #F8F6F2;
  --pure-white: #FFFFFF;

  /* Status */
  --status-active: #10B981;
  --status-leave:  #F59E0B;
  --status-suspended: #EF4444;
  --status-terminated: #6B7280;

  /* Typography */
  --font-sans: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;

  /* Layout */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(30,30,30,.05);
  --shadow: 0 4px 12px rgba(30,30,30,.06), 0 1px 3px rgba(30,30,30,.04);
  --shadow-lg: 0 12px 28px rgba(30,30,30,.10);

  --sidebar-w: 260px;
  --topbar-h: 68px;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--off-white);
  color: var(--neutral-900);
  direction: rtl;
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand-gold); color: white; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--neutral-200); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-bronze); }

/* =========================================================================
   Login Screen
   ========================================================================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--off-white);
}
.login-brand {
  background:
    radial-gradient(circle at 30% 20%, rgba(166,140,109,.15), transparent 60%),
    linear-gradient(135deg, #1E1E1E 0%, #2a241f 100%);
  color: var(--off-white);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.02) 0 1px, transparent 1px 32px);
  pointer-events: none;
}
.login-logo { position: relative; z-index: 1; }
.login-logo .mark {
  width: 68px; height: 68px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-bronze) 100%);
  box-shadow: 0 10px 30px rgba(166,140,109,.4);
  font-size: 32px; color: white;
  font-weight: 700;
}
.login-hero { position: relative; z-index: 1; }
.login-hero h1 {
  font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.15; margin: 0 0 16px;
  background: linear-gradient(135deg, #fff 0%, #d4c9b8 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 700;
}
.login-hero p { color: rgba(255,255,255,.7); font-size: var(--fs-lg); max-width: 480px; }
.login-footer { position: relative; z-index: 1; color: rgba(255,255,255,.4); font-size: var(--fs-sm); }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form { width: 100%; max-width: 420px; }
.login-form h2 { font-size: var(--fs-2xl); font-weight: 600; margin: 0 0 8px; }
.login-form .sub { color: var(--neutral-600); margin-bottom: 32px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 500; font-size: var(--fs-sm); margin-bottom: 8px; color: var(--neutral-700); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--radius);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--neutral-900);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-bronze);
  box-shadow: 0 0 0 4px rgba(143,121,97,.12);
}
.field .hint { font-size: var(--fs-xs); color: var(--neutral-600); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius);
  font-weight: 500; font-size: var(--fs-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-bronze) 0%, var(--brand-bronze-600) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(143,121,97,.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(143,121,97,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: white; color: var(--neutral-900); border: 1.5px solid var(--neutral-200); }
.btn-secondary:hover { border-color: var(--brand-bronze); color: var(--brand-bronze); }
.btn-ghost { background: transparent; color: var(--neutral-600); }
.btn-ghost:hover { background: var(--neutral-100); color: var(--neutral-900); }
.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn-lg { padding: 14px 24px; font-size: var(--fs-base); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* =========================================================================
   App Shell (Sidebar + Topbar + Content)
   ========================================================================= */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

.sidebar {
  background: var(--neutral-900);
  color: rgba(255,255,255,.85);
  padding: 24px 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 16px;
}
.sidebar .brand .mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-bronze));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 20px;
}
.sidebar .brand .brand-text .title { font-weight: 600; font-size: var(--fs-lg); color: white; }
.sidebar .brand .brand-text .subtitle { font-size: var(--fs-xs); color: rgba(255,255,255,.5); }

.sidebar nav { padding: 0 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  margin-bottom: 4px;
  transition: all var(--transition);
  font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: white; }
.nav-item.active {
  background: linear-gradient(135deg, var(--brand-bronze) 0%, var(--brand-bronze-600) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(143,121,97,.25);
}
.nav-item i { width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.06);
  font-size: var(--fs-xs); color: rgba(255,255,255,.4);
}

.topbar {
  height: var(--topbar-h); background: white;
  border-bottom: 1px solid var(--neutral-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .page-title { font-size: var(--fs-xl); font-weight: 600; color: var(--neutral-900); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--off-white); border-radius: 999px;
  cursor: pointer;
}
.user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-bronze));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.user-chip .info .name { font-size: var(--fs-sm); font-weight: 500; }
.user-chip .info .role { font-size: var(--fs-xs); color: var(--neutral-600); }

.content { padding: 28px 32px; }

/* =========================================================================
   Common: Page header, KPI cards, tables, badges, modals
   ========================================================================= */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; }
.page-header p { margin: 4px 0 0; color: var(--neutral-600); font-size: var(--fs-sm); }

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi-card {
  background: white; padding: 22px; border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; right: 0; height: 3px; width: 60%;
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-bronze));
  border-radius: 2px;
}
.kpi-card .label { font-size: var(--fs-sm); color: var(--neutral-600); margin-bottom: 8px; }
.kpi-card .value { font-size: var(--fs-3xl); font-weight: 700; color: var(--neutral-900); }
.kpi-card .icon {
  position: absolute; bottom: 12px; left: 12px;
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(143,121,97,.1); color: var(--brand-bronze);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.kpi-card.accent-green::before { background: linear-gradient(90deg, #34d399, var(--status-active)); }
.kpi-card.accent-amber::before { background: linear-gradient(90deg, #fbbf24, var(--status-leave)); }
.kpi-card.accent-red::before   { background: linear-gradient(90deg, #f87171, var(--status-suspended)); }

.card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200); padding: 22px;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.toolbar .search {
  flex: 1; min-width: 220px;
  padding: 10px 14px; border: 1.5px solid var(--neutral-200);
  border-radius: var(--radius); background: white;
}
.toolbar .search:focus { outline: none; border-color: var(--brand-bronze); }
.toolbar select { padding: 10px 14px; border: 1.5px solid var(--neutral-200); border-radius: var(--radius); background: white; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--neutral-200); background: white; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data thead th {
  text-align: right; padding: 12px 14px;
  background: var(--off-white); border-bottom: 1px solid var(--neutral-200);
  font-weight: 600; color: var(--neutral-700); white-space: nowrap;
}
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--neutral-100); }
table.data tbody tr:hover { background: var(--off-white); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .row-actions { display: flex; gap: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 500;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active     { background: rgba(16,185,129,.12); color: #059669; }
.badge-on_leave   { background: rgba(245,158,11,.12); color: #b45309; }
.badge-suspended  { background: rgba(239,68,68,.12);  color: #b91c1c; }
.badge-terminated { background: rgba(107,114,128,.14); color: #4b5563; }

.badge-pending    { background: rgba(107,114,128,.14); color: #4b5563; }
.badge-in_progress{ background: rgba(59,130,246,.12); color: #1d4ed8; }
.badge-completed  { background: rgba(16,185,129,.12); color: #059669; }
.badge-approved   { background: rgba(16,185,129,.12); color: #059669; }
.badge-rejected   { background: rgba(239,68,68,.12);  color: #b91c1c; }
.badge-returned   { background: rgba(245,158,11,.12); color: #b45309; }

.priority-low     { color: var(--neutral-600); }
.priority-medium  { color: #3b82f6; }
.priority-high    { color: #f59e0b; }
.priority-urgent  { color: #ef4444; font-weight: 700; }

.days-badge {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  font-size: var(--fs-xs); font-weight: 500;
}
.days-ok { background: rgba(16,185,129,.1); color: #059669; }
.days-warn { background: rgba(245,158,11,.14); color: #b45309; }
.days-danger { background: rgba(239,68,68,.14); color: #b91c1c; }
.days-expired { background: var(--neutral-900); color: white; }

/* =========================================================================
   Modal / Drawer
   ========================================================================= */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30,30,30,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(4px);
  animation: fadeIn .18s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: white; border-radius: var(--radius-lg);
  width: min(720px, 96vw); max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .22s ease-out;
  box-shadow: var(--shadow-lg);
}
.modal.modal-lg { width: min(960px, 96vw); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--neutral-100);
}
.modal-header h3 { margin: 0; font-size: var(--fs-xl); font-weight: 600; }
.modal-close { color: var(--neutral-600); font-size: 20px; }
.modal-close:hover { color: var(--neutral-900); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--neutral-100);
  display: flex; gap: 10px; justify-content: flex-start;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.tabs { display: flex; border-bottom: 1px solid var(--neutral-200); margin-bottom: 20px; gap: 4px; }
.tab {
  padding: 10px 16px; font-size: var(--fs-sm); font-weight: 500; color: var(--neutral-600);
  border-bottom: 2px solid transparent; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--brand-bronze); }
.tab.active { color: var(--brand-bronze); border-bottom-color: var(--brand-bronze); }

/* Toasts */
.toast-stack { position: fixed; top: 24px; left: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; background: white;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border-right: 4px solid var(--brand-bronze);
  min-width: 260px; animation: slideUp .2s ease-out;
  font-size: var(--fs-sm);
}
.toast.success { border-right-color: var(--status-active); }
.toast.error   { border-right-color: var(--status-suspended); }
.toast.info    { border-right-color: #3b82f6; }

/* Workflow visualization */
.workflow {
  display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap;
  padding: 8px 0;
}
.workflow-step {
  flex: 1; min-width: 180px;
  padding: 14px; border-radius: var(--radius);
  background: var(--off-white); border: 1.5px solid var(--neutral-200);
  position: relative;
}
.workflow-step.active { border-color: var(--brand-bronze); background: rgba(143,121,97,.06); }
.workflow-step.completed { border-color: var(--status-active); background: rgba(16,185,129,.06); }
.workflow-step.rejected { border-color: var(--status-suspended); }
.workflow-step .step-num {
  position: absolute; top: -10px; right: -10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-bronze); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700;
}
.workflow-step.completed .step-num { background: var(--status-active); }
.workflow-step.rejected .step-num { background: var(--status-suspended); }
.workflow-step .assignee { font-weight: 600; }
.workflow-step .action { font-size: var(--fs-xs); color: var(--neutral-600); margin-top: 2px; }

/* Permission matrix */
.perm-table { width: 100%; }
.perm-level {
  display: inline-flex; padding: 4px 12px; border-radius: 6px; font-size: var(--fs-xs);
  cursor: pointer; margin: 2px; border: 1.5px solid transparent;
  transition: all var(--transition); user-select: none;
}
.perm-level.selected { background: var(--brand-bronze); color: white; border-color: var(--brand-bronze); }
.perm-level:not(.selected):hover { border-color: var(--brand-bronze); }

/* Empty state */
.empty {
  text-align: center; padding: 60px 20px; color: var(--neutral-600);
}
.empty .icon { font-size: 48px; color: var(--neutral-300); margin-bottom: 12px; }
.empty h4 { margin: 0 0 6px; color: var(--neutral-700); font-weight: 500; }

/* Skeleton loader */
.skeleton { background: linear-gradient(90deg, var(--neutral-100) 25%, var(--neutral-200) 50%, var(--neutral-100) 75%);
            background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; right: 0; width: 260px; z-index: 20; transform: translateX(100%); transition: transform .24s ease; }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 20px 16px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
}

.sidebar-toggle { display: none; }
@media (max-width: 900px) { .sidebar-toggle { display: inline-flex; } }

/* Utility */
.hidden { display: none !important; }
.text-muted { color: var(--neutral-600); }
.text-danger { color: var(--status-suspended); }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* File upload zone */
.dropzone {
  border: 2px dashed var(--neutral-300); border-radius: var(--radius);
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
  background: var(--off-white);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand-bronze); background: rgba(143,121,97,.05); }
.dropzone i { font-size: 32px; color: var(--brand-bronze); margin-bottom: 8px; display: block; }

/* Simple bar for charts */
.chart-bar { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 12px 0; }
.chart-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar-item .bar {
  width: 100%; background: linear-gradient(180deg, var(--brand-gold), var(--brand-bronze));
  border-radius: 6px 6px 0 0; min-height: 4px; transition: height .5s ease;
}
.chart-bar-item .lbl { font-size: var(--fs-xs); color: var(--neutral-600); text-align: center; }
.chart-bar-item .val { font-size: var(--fs-xs); font-weight: 600; }

/* Docs list */
.doc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--off-white); border-radius: var(--radius);
  margin-bottom: 8px;
}
.doc-item .doc-info { display: flex; align-items: center; gap: 10px; }
.doc-item .doc-icon { width: 36px; height: 36px; border-radius: 8px; background: rgba(143,121,97,.12); color: var(--brand-bronze);
  display: flex; align-items: center; justify-content: center; font-size: 16px; }

.expiry-item {
  padding: 12px 14px; border: 1px solid var(--neutral-200); border-radius: var(--radius);
  margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between;
}
.expiry-item .lbl { color: var(--neutral-700); font-size: var(--fs-sm); }

/* =========================================================================
   Purchase Timeline (Vertical)
   ========================================================================= */
.purchase-timeline {
  position: relative;
  padding: 8px 0;
}
.purchase-timeline::before {
  content: '';
  position: absolute;
  top: 20px; bottom: 20px;
  right: 20px;
  width: 2px;
  background: linear-gradient(180deg, var(--brand-gold), var(--brand-bronze), var(--neutral-200));
}
.timeline-step {
  position: relative;
  padding: 8px 60px 20px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.timeline-marker {
  position: absolute;
  top: 4px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 700;
  background: var(--neutral-300);
  z-index: 1;
  border: 3px solid var(--pure-white);
  box-shadow: 0 0 0 2px var(--neutral-300);
}
.timeline-step.timeline-active .timeline-marker {
  background: var(--brand-bronze);
  box-shadow: 0 0 0 2px var(--brand-bronze), 0 0 12px rgba(143,121,97,.4);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--brand-bronze), 0 0 8px rgba(143,121,97,.3); }
  50% { box-shadow: 0 0 0 2px var(--brand-bronze), 0 0 20px rgba(143,121,97,.6); }
}
.timeline-step.timeline-approved .timeline-marker {
  background: var(--status-active);
  box-shadow: 0 0 0 2px var(--status-active);
}
.timeline-step.timeline-rejected .timeline-marker {
  background: var(--status-suspended);
  box-shadow: 0 0 0 2px var(--status-suspended);
}
.timeline-step.timeline-returned .timeline-marker {
  background: var(--status-leave);
  box-shadow: 0 0 0 2px var(--status-leave);
}
.timeline-content {
  flex: 1;
  padding: 12px 16px;
  background: var(--off-white);
  border-radius: var(--radius);
  border: 1.5px solid var(--neutral-200);
  transition: all var(--transition);
}
.timeline-step.timeline-active .timeline-content {
  background: rgba(143,121,97,.08);
  border-color: var(--brand-bronze);
}
.timeline-step.timeline-approved .timeline-content {
  background: rgba(16,185,129,.06);
  border-color: rgba(16,185,129,.3);
}
.timeline-step.timeline-rejected .timeline-content {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.3);
}
.timeline-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.timeline-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--neutral-600);
}
.timeline-time { font-size: 11px; color: var(--neutral-600); margin-top: 6px; }

/* Pending badge (extra) */
.badge-pending { background: rgba(107,114,128,.14); color: #4b5563; }

/* ===== Units Management additions ===== */

/* Sidebar collapsible group */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle { width: 100%; background: none; border: none; cursor: pointer; font: inherit; }
.nav-group .nav-chevron { transition: transform .2s ease; font-size: 12px; opacity: .6; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-group-items { max-height: 0; overflow: hidden; transition: max-height .25s ease; padding-right: 14px; }
.nav-group.open .nav-group-items { max-height: 300px; }
.nav-group-items .nav-item { font-size: 13px; padding-top: 8px; padding-bottom: 8px; }
.nav-group-items .nav-item::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.28); flex-shrink: 0; }

/* Attachment pills (HR + investors tables) */
.attach-badges { display: inline-flex; gap: 6px; align-items: center; }
.attach-pill { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; border: 1px solid transparent; transition: transform .15s ease; }
.attach-pill:hover { transform: translateY(-2px); }
.attach-pill.has { background: rgba(16,185,129,.14); color: #059669; border-color: rgba(16,185,129,.35); }
.attach-pill.missing { background: var(--neutral-100, #f1f1f1); color: #9aa0a6; }

/* Progress bar (tracker cards) */
.progress-track { height: 8px; border-radius: 999px; background: var(--neutral-100, #eee); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-gold, #A68C6D), var(--brand-bronze, #8F7961)); transition: width .3s ease; }

/* Tracker settings step rows */
.settings-step-row { display: flex; gap: 12px; align-items: stretch; padding: 12px; background: var(--off-white, #faf8f5); border-radius: 10px; border-right: 3px solid var(--brand-bronze, #8F7961); margin-bottom: 10px; }
.settings-step-row .step-badge { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-bronze, #8F7961); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.settings-step-row select[multiple] { min-height: 84px; }

/* Leaflet popup RTL tweaks */
.leaflet-popup-content { margin: 12px 14px; }

/* Custom high-visibility map pins (L.divIcon) */
.raf-map-pin-wrap { background: none; border: none; }
.raf-map-pin {
  position: relative; width: 42px; height: 42px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--pin, #059669);
  border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  animation: raf-pin-float 2.4s ease-in-out infinite;
}
.raf-map-pin i { transform: rotate(45deg); color: #fff; font-size: 17px; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.raf-map-pin::after {
  content: ''; position: absolute; bottom: -12px; left: 50%;
  width: 14px; height: 6px; border-radius: 50%; background: rgba(0,0,0,.22);
  transform: translateX(-50%) rotate(45deg); filter: blur(1px);
}
.raf-map-pin-wrap:hover .raf-map-pin { animation-play-state: paused; box-shadow: 0 10px 20px rgba(0,0,0,.45); }
@keyframes raf-pin-float {
  0%, 100% { transform: rotate(-45deg) translateY(0); }
  50% { transform: rotate(-45deg) translateY(-5px); }
}

/* ===== Leave Management ===== */
.leave-kpi-pill { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.leave-pill-ok { background: rgba(16,185,129,.12); color:#059669; }
.leave-pill-warn { background: rgba(245,158,11,.12); color:#b45309; }
.leave-pill-danger { background: rgba(239,68,68,.12); color:#b91c1c; }
.leave-type-badge { padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; background: rgba(143,121,97,.12); color: var(--brand-bronze,#8F7961); }

/* ===== Knowledge Base (مشاكل وحلول) ===== */
.issue-toolbar { display:flex; flex-direction:column; gap:14px; margin-bottom:20px; }
.issue-search-wrap { position:relative; max-width:520px; }
.issue-search-wrap i { position:absolute; inset-inline-start:14px; top:50%; transform:translateY(-50%); color:#9aa0a6; }
.issue-search { width:100%; padding:12px 42px 12px 16px; border:1px solid var(--neutral-200,#e5e2dc); border-radius:12px; font:inherit; background:#fff; transition:border-color .2s, box-shadow .2s; }
.issue-search:focus { outline:none; border-color:var(--brand-bronze,#8F7961); box-shadow:0 0 0 3px rgba(143,121,97,.15); }
.issue-filters { display:flex; flex-wrap:wrap; gap:8px; }
.issue-chip { display:inline-flex; align-items:center; gap:7px; padding:8px 14px; border-radius:999px; border:1px solid var(--neutral-200,#e5e2dc); background:#fff; cursor:pointer; font:inherit; font-size:13px; color:var(--neutral-700,#444); transition:all .18s ease; }
.issue-chip:hover { transform:translateY(-1px); border-color:var(--brand-bronze,#8F7961); }
.issue-chip.active { background:var(--brand-bronze,#8F7961); color:#fff; border-color:var(--brand-bronze,#8F7961); }
.issue-chip-count { background:rgba(0,0,0,.10); border-radius:999px; padding:1px 8px; font-size:11px; font-weight:700; }
.issue-chip.active .issue-chip-count { background:rgba(255,255,255,.25); }

.issue-list { display:flex; flex-direction:column; gap:12px; }
.issue-card { background:#fff; border:1px solid var(--neutral-200,#e5e2dc); border-radius:14px; overflow:hidden; transition:box-shadow .2s, border-color .2s; }
.issue-card:hover { box-shadow:0 6px 18px rgba(0,0,0,.06); }
.issue-card.open { border-color:var(--brand-bronze,#8F7961); }
.issue-head { width:100%; display:flex; align-items:center; gap:14px; padding:16px 18px; background:none; border:none; cursor:pointer; font:inherit; text-align:right; }
.issue-cat-tag { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; color:var(--brand-bronze,#8F7961); background:rgba(143,121,97,.10); padding:5px 11px; border-radius:999px; white-space:nowrap; }
.issue-title { flex:1; font-weight:600; font-size:15px; color:var(--neutral-900,#222); }
.issue-chevron { color:#9aa0a6; transition:transform .25s ease; }
.issue-card.open .issue-chevron { transform:rotate(180deg); }
.issue-body { max-height:0; overflow:hidden; transition:max-height .3s ease; padding:0 18px; }
.issue-card.open .issue-body { max-height:1600px; padding:0 18px 18px; }
.issue-section { margin-top:14px; padding:14px; border-radius:10px; background:var(--off-white,#faf8f5); }
.issue-section-sol { background:rgba(16,185,129,.07); }
.issue-section-cons { background:rgba(239,68,68,.07); }
.issue-section-head { display:flex; align-items:center; gap:8px; font-weight:700; font-size:13px; margin-bottom:8px; color:var(--brand-bronze,#8F7961); }
.issue-section-sol .issue-section-head { color:#059669; }
.issue-section-cons .issue-section-head { color:#b91c1c; }
.issue-section-text { white-space:pre-wrap; line-height:1.8; color:var(--neutral-700,#444); font-size:14px; }
.issue-actions { display:flex; gap:8px; margin-top:16px; padding-top:14px; border-top:1px dashed var(--neutral-200,#e5e2dc); }



/* ===== v6: Notifications, location badge, section tabs ===== */
.notif-bell { position: relative; }
.notif-badge {
  position: absolute; top: 2px; inset-inline-end: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #ef4444; color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
#notif-pop {
  width: 344px; max-height: 460px; overflow: auto;
  background: #fff; border: 1px solid var(--neutral-200);
  border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 200;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--neutral-100);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.notif-head strong { font-size: 15px; }
.notif-markall { background: none; border: none; cursor: pointer; color: var(--brand-bronze); font-size: 12px; font-weight: 600; }
.notif-markall:hover { text-decoration: underline; }
.notif-item {
  display: flex; gap: 10px; padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--neutral-100); transition: background-color .15s ease;
}
.notif-item:hover { background: var(--neutral-100); }
.notif-item.unread { background: rgba(143,121,97,.06); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; flex-shrink: 0; }
.notif-item.unread .notif-dot { background: var(--brand-bronze); }
.notif-title { font-weight: 600; font-size: 13px; color: var(--neutral-900); }
.notif-msg { font-size: 12px; color: var(--neutral-600); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.notif-time { font-size: 11px; color: var(--neutral-500); margin-top: 4px; }
.notif-empty { padding: 40px 16px; text-align: center; color: var(--neutral-500); }
.notif-empty i { font-size: 26px; display: block; margin-bottom: 8px; opacity: .5; }

/* Location badge on unit cards */
.loc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(59,130,246,.10); color: #1d4ed8;
  font-size: 12px; font-weight: 500;
}
.loc-badge i { font-size: 11px; }

/* Section management tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--neutral-200); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; background: none; border: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--neutral-600);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--neutral-900); }
.tab.active { color: var(--brand-bronze); border-bottom-color: var(--brand-bronze); }

/* Sidebar module management rows */
.mod-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--neutral-200); border-radius: 10px; margin-bottom: 8px; background: #fff;
}
.mod-row.hidden-mod { opacity: .55; background: var(--neutral-100); }
.mod-row .mod-icon {
  width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0;
  background: rgba(143,121,97,.12); color: var(--brand-bronze);
  display: flex; align-items: center; justify-content: center;
}
.mod-row .mod-order { display: flex; flex-direction: column; gap: 2px; }
.mod-row .mod-order button {
  width: 24px; height: 20px; border: 1px solid var(--neutral-200); background: #fff;
  border-radius: 5px; cursor: pointer; color: var(--neutral-600); line-height: 1;
}
.mod-row .mod-order button:disabled { opacity: .3; cursor: not-allowed; }
