/* ============================================================
   TETRALIFT CRM — MAIN CSS
   Global design system, layout, sidebar, topbar, utilities
   ============================================================ */

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

/* ─── CSS VARIABLES ────────────────────────────────────────────── */
:root {
  /* ── Tetralift Brand (Company Colors) ── */
  --brand-primary:        #E8621A;   /* Tetralift Orange */
  --brand-primary-dark:   #C4511A;   /* Deep Orange */
  --brand-primary-light:  #FEF0E6;   /* Light orange */
  
  --brand-accent:         #F97316;   /* Vibrant Orange */
  --brand-accent-dark:    #EA580C;
  --brand-accent-light:   #FFEDD5;

  --brand-secondary:      #4A6B30;   /* Pyramid Green */
  --brand-secondary-light:#EBF3E5;

  /* Semantic colors */
  --success:       #10B981;
  --success-light: #ECFDF5;
  --danger:        #EF4444;
  --danger-light:  #FEF2F2;
  --warning:       #F59E0B;
  --warning-light: #FFFBEB;
  --info:          #0EA5E9;
  --info-light:    #F0F9FF;
  --purple:        #8B5CF6;
  --purple-light:  #F5F3FF;
  --cyan:          #06B6D4;
  --cyan-light:    #ECFEFF;

  /* Backgrounds */
  --bg-app:        #F8FAFC;          /* Crisp off-white */
  --bg-white:      #FFFFFF;
  --bg-sidebar:    #FFFFFF;
  --bg-sidebar-hover:   #FEF0E6;     /* Orange light hover */
  --bg-sidebar-active:  #FFEDD5;     /* Light orange active */

  /* Text */
  --text-primary:  #1A1A1A;
  --text-secondary:#475569;
  --text-muted:    #94A3B8;
  --text-white:    #FFFFFF;
  --text-sidebar:  #64748B;
  --text-sidebar-active: #E8621A;

  /* Borders */
  --border:        #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus:  #E8621A;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(232, 98, 26, 0.05);
  --shadow-sm: 0 1px 3px rgba(232, 98, 26, 0.08), 0 1px 2px rgba(232, 98, 26, 0.04);
  --shadow-md: 0 4px 16px rgba(232, 98, 26, 0.08), 0 2px 4px rgba(232, 98, 26, 0.04);
  --shadow-lg: 0 10px 32px rgba(232, 98, 26, 0.10), 0 4px 8px rgba(232, 98, 26, 0.05);
  --shadow-xl: 0 20px 48px rgba(232, 98, 26, 0.12);

  /* Layout */
  --sidebar-width:       260px;
  --sidebar-collapsed:   72px;
  --topbar-height:       64px;

  /* Radius */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-full:9999px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: all 0.3s cubic-bezier(0.4,0,0.2,1);

  /* Typography */
  --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-ar: 'Cairo', 'Segoe UI', sans-serif;
  --font: var(--font-en);
}


/* â”€â”€â”€ ARABIC / RTL SUPPORT â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
[lang="ar"] {
  --font: var(--font-ar);
  direction: rtl;
}
[lang="ar"] body { font-family: var(--font-ar); }

/* â”€â”€â”€ RESET & BASE â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-en);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

[lang="ar"] body {
  font-family: var(--font-ar);
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
input, button, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* â”€â”€â”€ SCROLLBAR â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* â”€â”€â”€ APP LAYOUT â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* â”€â”€â”€ SIDEBAR â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1.5px solid var(--border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
  overflow: hidden;
}

[lang="ar"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1.5px solid var(--border);
}

.sidebar.collapsed {
  width: 0 !important;
  overflow: hidden !important;
  border-right: none !important;
}

/* Sidebar Logo */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: var(--brand-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -1px;
}

.sidebar-logo-text {
  overflow: hidden;
  transition: var(--transition);
}
.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }

.sidebar-logo-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}
.sidebar.collapsed .sidebar-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  color: var(--text-sidebar);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  margin-bottom: 4px;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--brand-primary);
}

.nav-item.active {
  background: var(--brand-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(232, 98, 26, 0.3);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2;
}

.nav-item .nav-label {
  overflow: hidden;
  transition: var(--transition);
}
.sidebar.collapsed .nav-item .nav-label { opacity: 0; width: 0; }

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-item .nav-badge { display: none; }

[lang="ar"] .nav-item .nav-badge { margin-left: 0; margin-right: auto; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: #F8FAFC;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.sidebar-user:hover { background: #F1F5F9; border-color: var(--border-strong); }

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  transition: var(--transition);
}
.sidebar.collapsed .sidebar-user-info { opacity: 0; width: 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-user-name .online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Lang toggle in sidebar */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 4px;
  transition: var(--transition);
}
.lang-toggle:hover { background: var(--bg-sidebar-hover); }

.lang-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
}
.lang-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--brand-primary);
}
.sidebar.collapsed .lang-btn .lang-label { display: none; }

/* Collapse toggle */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-app);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-left: auto;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--border); color: var(--text-primary); }
[lang="ar"] .sidebar-collapse-btn { margin-left: 0; margin-right: auto; }
.sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }
[lang="ar"] .sidebar.collapsed .sidebar-collapse-btn { transform: rotate(0deg); }

/* â”€â”€â”€ MAIN CONTENT â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  overflow-x: hidden;
}
[lang="ar"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }
.sidebar.collapsed ~ .main-content {
  margin-left: 0 !important;
  width: 100% !important;
}
[lang="ar"] .sidebar.collapsed ~ .main-content {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.sidebar.collapsed ~ .main-content .mobile-menu-btn {
  display: flex !important;
}

/* â”€â”€â”€ TOPBAR â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px -2px rgba(0,0,0,0.02);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(241, 245, 249, 0.7);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 10px 20px;
  width: 400px;
  transition: var(--transition);
}
.topbar-search:focus-within {
  background: #FFFFFF;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(232, 98, 26, 0.1);
}
.topbar-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); font-weight: 500; }
.topbar-search svg { color: var(--text-muted); flex-shrink: 0; stroke-width: 2.5; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg-app); color: var(--text-primary); }

.mobile-menu-btn { display: none; }

.icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
  border: 2px solid #fff;
}

/* â”€â”€â”€ PAGE CONTENT â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.page-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
  max-width: 100%;
}

/* â”€â”€â”€ PAGE HEADER â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-header-left p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* â”€â”€â”€ TYPOGRAPHY â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
h4 { font-size: 15px; font-weight: 600; }
h5 { font-size: 13px; font-weight: 600; }
h6 { font-size: 12px; font-weight: 600; }

/* â”€â”€â”€ BUTTONS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font);
  line-height: 1.4;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
.btn-primary:hover {
  background: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 98, 26, 0.35);
}

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

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #DC2626; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}
.btn-warning:hover { background: #D97706; }

.btn-outline-primary {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline-primary:hover {
  background: var(--brand-primary-light);
}

.btn-sm { padding: 6px 12px; font-size: 12px; gap: 5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon {
  padding: 9px;
  border-radius: var(--radius-sm);
}
.btn-icon-sm { padding: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* â”€â”€â”€ FORM ELEMENTS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-white);
  transition: var(--transition);
  outline: none;
  font-family: var(--font);
}
.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(232, 98, 26, 0.12);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg-app); cursor: not-allowed; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
[lang="ar"] select.form-control {
  background-position: left 12px center;
  padding-right: 14px;
  padding-left: 36px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.input-group {
  display: flex;
  align-items: center;
}
.input-group-icon {
  padding: 10px 12px;
  background: var(--bg-app);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
[lang="ar"] .input-group-icon {
  border-right: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
[lang="ar"] .input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* â”€â”€â”€ BADGES â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-primary   { background: var(--brand-primary-light); color: var(--brand-primary); }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light); color: var(--danger); }
.badge-warning   { background: var(--warning-light); color: #B45309; }
.badge-info      { background: var(--info-light); color: var(--info); }
.badge-purple    { background: var(--purple-light); color: var(--purple); }
.badge-cyan      { background: var(--cyan-light); color: var(--cyan); }
.badge-gray      { background: #F1F5F9; color: var(--text-secondary); }
.badge-secondary { background: var(--brand-secondary-light); color: #B45309; }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* â”€â”€â”€ AVATAR â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }

.avatar-success { background: var(--success); }
.avatar-warning { background: var(--warning); }
.avatar-danger  { background: var(--danger); }
.avatar-purple  { background: var(--purple); }
.avatar-cyan    { background: var(--cyan); }
.avatar-secondary { background: var(--brand-secondary); }

/* â”€â”€â”€ UTILITIES â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-4        { gap: 4px; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.gap-24       { gap: 24px; }
.flex-1       { flex: 1; }
.flex-wrap    { flex-wrap: wrap; }

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

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }
.text-brand     { color: var(--brand-primary); }

.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }

.text-xs    { font-size: 11px; }
.text-sm    { font-size: 13px; }
.text-base  { font-size: 14px; }
.text-lg    { font-size: 16px; }
.text-xl    { font-size: 18px; }
.text-2xl   { font-size: 22px; }
.text-3xl   { font-size: 28px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full      { width: 100%; }
.h-full      { height: 100%; }
.hidden      { display: none !important; }
.ml-auto     { margin-left: auto; }
.mr-auto     { margin-right: auto; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.p-8         { padding: 8px; }
.p-16        { padding: 16px; }
.p-24        { padding: 24px; }

/* â”€â”€â”€ LOADING SPINNER â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* â”€â”€â”€ TOAST NOTIFICATIONS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
[lang="ar"] .toast-container { right: auto; left: 20px; }

.toast {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1);
  border-left: 4px solid var(--brand-primary);
}
.toast.toast-success { border-color: var(--success); }
.toast.toast-error   { border-color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); }

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

.toast-icon { flex-shrink: 0; }
.toast-message { font-size: 13.5px; font-weight: 500; color: var(--text-primary); flex: 1; }

/* â”€â”€â”€ DROPDOWN â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
  animation: dropIn 0.15s cubic-bezier(0.4,0,0.2,1);
}
[lang="ar"] .dropdown-menu { right: auto; left: 0; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg-app); color: var(--brand-primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* â”€â”€â”€ EMPTY STATE â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-app);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}
.empty-state h4 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; margin-bottom: 20px; }

/* â”€â”€â”€ PROGRESS BAR â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  transition: width 0.6s ease;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* â”€â”€â”€ DIVIDER â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* â”€â”€â”€ ANIMATIONS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s cubic-bezier(0.4,0,0.2,1) both; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.slide-in { animation: slideIn 0.3s cubic-bezier(0.4,0,0.2,1) both; }

/* Stagger children */
.stagger-children > * { animation: fadeIn 0.3s cubic-bezier(0.4,0,0.2,1) both; }
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

/* â”€â”€â”€ RESPONSIVE â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .sidebar { 
    transform: translateX(-100%); 
    position: fixed; 
    top: 0; 
    bottom: 0; 
    left: 0; 
    z-index: 9999; 
    box-shadow: var(--shadow-xl); 
  }
  [lang="ar"] .sidebar { transform: translateX(100%); right: 0; left: auto; }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  .mobile-menu-btn { display: flex; }
  .hidden-mobile { display: none !important; }

  /* Mobile Bottom Navigation */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    flex: 1;
    color: #64748B;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
  }
  .bottom-nav-item svg { margin-bottom: 4px; }
  .bottom-nav-item.active { color: var(--primary); }
  
  /* Add padding to body so content isn't hidden behind bottom nav */
  body { padding-bottom: 60px; }

  /* Fix for horizontal scroll on mobile */
  body, .app-layout, .main-content { overflow-x: hidden; width: 100%; max-width: 100vw; }
  .card { max-width: calc(100vw - 32px); }
  
  .page-content { padding: 16px; }
  .grid-2, .grid-3, .grid-4, .kpi-grid, .dashboard-grid, .responsive-grid-2 { grid-template-columns: 1fr !important; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header-actions { width: 100%; justify-content: flex-start; }
}

/* â”€â”€â”€ PRINT â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media print {
  .sidebar, .topbar, .page-header-actions, .btn { display: none !important; }
  .main-content { margin: 0 !important; width: 100% !important; }
  .page-content { padding: 0 !important; }
}

@media (max-width: 992px) {
  .sidebar-collapse-btn { display: flex !important; }
}

