/* ==========================================================================
   Bismillah Trading - Modern UI Design System
   Matches dashboard-react exact styling, typography, colors & dark mode
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* --- Root Design Tokens (Light Mode) --- */
:root {
  /* Primary Color Scale (Electric Blue) */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  --primary-950: #172554;

  /* Slate Neutral Scale */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Accent Colors */
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;

  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --purple-50: #faf5ff;
  --purple-100: #f3e8ff;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  --purple-700: #7e22ce;

  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;

  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;

  /* Theme Surfaces & Semantics (Light) */
  --bg-body: var(--slate-50);
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: var(--slate-100);
  --bg-muted: var(--slate-50);

  --text-primary: var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-muted: var(--slate-500);
  --text-subtle: var(--slate-400);

  --border-color: var(--slate-200);
  --border-subtle: var(--slate-100);

  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-primary: 0 10px 15px -3px rgba(37, 99, 235, 0.25);

  --radius-sm: 0.375rem; /* 6px */
  --radius-md: 0.5rem;   /* 8px */
  --radius-lg: 0.75rem;  /* 12px */
  --radius-xl: 1rem;     /* 16px */
  --radius-2xl: 1.25rem; /* 20px */
  --radius-3xl: 1.5rem;  /* 24px */
  --radius-full: 9999px;

  --sidebar-width: 16.25rem; /* 260px */
  --sidebar-collapsed-width: 5rem; /* 80px */
  --topbar-height: 4rem; /* 64px */

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Mode Overrides --- */
html.dark, body.dark {
  --bg-body: var(--slate-950);
  --bg-surface: var(--slate-900);
  --bg-surface-elevated: #131d33;
  --bg-subtle: var(--slate-800);
  --bg-muted: rgba(30, 41, 59, 0.5);

  --text-primary: var(--slate-100);
  --text-secondary: var(--slate-300);
  --text-muted: var(--slate-400);
  --text-subtle: var(--slate-500);

  --border-color: var(--slate-800);
  --border-subtle: rgba(30, 41, 59, 0.6);

  --sidebar-bg: var(--slate-900);
  --topbar-bg: var(--slate-900);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  --shadow-primary: 0 0 20px rgba(37, 99, 235, 0.35);

  /* Tinted background variants for dark mode badges */
  --green-50: rgba(34, 197, 94, 0.15);
  --green-100: rgba(34, 197, 94, 0.2);
  --green-700: #4ade80;

  --red-50: rgba(239, 68, 68, 0.15);
  --red-100: rgba(239, 68, 68, 0.2);
  --red-700: #f87171;

  --amber-50: rgba(245, 158, 11, 0.15);
  --amber-100: rgba(245, 158, 11, 0.2);
  --amber-700: #fbbf24;

  --purple-50: rgba(168, 85, 247, 0.15);
  --purple-100: rgba(168, 85, 247, 0.2);
  --purple-700: #c084fc;

  --orange-50: rgba(249, 115, 22, 0.15);
  --orange-100: rgba(249, 115, 22, 0.2);
  --orange-700: #fb923c;

  --indigo-50: rgba(99, 102, 241, 0.15);
  --indigo-100: rgba(99, 102, 241, 0.2);
  --indigo-700: #818cf8;

  --primary-50: rgba(59, 130, 246, 0.15);
  --primary-100: rgba(59, 130, 246, 0.25);
}

/* --- Base & Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-body);
  color: var(--text-primary);
  color-scheme: light;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
  zoom: 0.9;
}

@supports not (zoom: 1) {
  html {
    font-size: 90%;
  }
}

@media (max-width: 768px) {
  html {
    zoom: 1;
  }
}

html.dark {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  display: flex;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 9999px;
  transition: background var(--transition-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}
html.dark ::-webkit-scrollbar-thumb {
  background: var(--slate-700);
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--slate-600);
}

/* --- Layout Architecture --- */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-body);
  position: relative;
}

/* --- Sidebar --- */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: width var(--transition-smooth), transform var(--transition-smooth);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 2rem;
  height: 2rem;
  background-color: var(--primary-600);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.125rem;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-close-btn {
  display: none;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
}
.sidebar-close-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-normal);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-link i, .nav-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--text-subtle);
  transition: color var(--transition-normal);
}

.nav-link:hover i, .nav-link:hover svg {
  color: var(--text-secondary);
}

.nav-link.active {
  background-color: var(--primary-600);
  color: #ffffff;
  box-shadow: var(--shadow-primary);
  font-weight: 600;
}

.nav-link.active i, .nav-link.active svg {
  color: #ffffff;
}

.nav-link .nav-text {
  flex: 1;
}

.nav-chevron {
  width: 1rem;
  height: 1rem;
  margin-left: auto;
  transition: transform var(--transition-normal);
}

.submenu-parent.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  margin-left: 2.25rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border-subtle);
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.submenu-parent.open .nav-submenu {
  display: flex;
}

.submenu-link {
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.submenu-link:hover {
  color: var(--text-primary);
}

.submenu-link.active {
  color: var(--primary-600);
  font-weight: 600;
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

/* Collapsed Sidebar on Desktop */
body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-chevron,
body.sidebar-collapsed .nav-submenu {
  display: none !important;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem 0;
}

body.sidebar-collapsed .nav-link i,
body.sidebar-collapsed .nav-link svg {
  margin: 0;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* --- Main Content Wrapper --- */
.main-wrapper {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-smooth);
}

/* --- Topbar --- */
.app-topbar {
  height: var(--topbar-height);
  background-color: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  max-width: 500px;
}

.menu-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.menu-toggle-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

/* Global Search Container & Live Dropdown */
.search-container {
  position: relative;
  width: 100%;
  max-width: 380px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--text-subtle);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-input {
  width: 100%;
  height: 2.375rem;
  padding: 0 2.5rem 0 2.5rem;
  background-color: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-normal);
}

.search-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-subtle);
  border-radius: var(--radius-full);
}
.search-clear-btn:hover {
  color: var(--text-primary);
}

/* Search Dropdown Results */
.search-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  z-index: 60;
  display: none;
  animation: fadeInDown 0.2s ease forwards;
}

.search-dropdown.open {
  display: block;
}

.search-dropdown-header {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.search-dropdown-list {
  max-height: 320px;
  overflow-y: auto;
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.search-dropdown-item:last-child {
  border-bottom: none;
}

.search-dropdown-item:hover {
  background-color: var(--bg-subtle);
}

.search-item-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-lg);
  background-color: var(--primary-100);
  color: var(--primary-600);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.search-item-info {
  flex: 1;
  min-width: 0;
}

.search-item-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Live Clock */
.live-clock-widget {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.875rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
}

@media (min-width: 1024px) {
  .live-clock-widget {
    display: flex;
  }
}

.clock-icon {
  width: 1rem;
  height: 1rem;
  color: var(--primary-500);
  animation: pulseGlow 2s infinite ease-in-out;
}

.topbar-divider {
  width: 1px;
  height: 1.75rem;
  background-color: var(--border-color);
  margin: 0 0.25rem;
}

/* Language Switcher Dropdown */
.lang-dropdown-container {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 12rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  padding: 0.375rem;
  display: none;
  z-index: 60;
  animation: fadeInDown 0.2s ease forwards;
}

.lang-menu.open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.lang-option:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.lang-option.active {
  color: var(--primary-600);
  font-weight: 600;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

/* User Profile Pill & Dropdown */
.user-dropdown-container {
  position: relative;
}

.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.375rem;
  border-radius: var(--radius-2xl);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.user-pill-btn:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-subtle);
}

.user-info-text {
  text-align: right;
  display: none;
}

@media (min-width: 640px) {
  .user-info-text {
    display: block;
  }
}

.user-name {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.user-role-badge {
  font-size: 0.625rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-500);
  margin-top: 0.15rem;
}

.user-avatar {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
  flex-shrink: 0;
}

.user-chevron {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-subtle);
  transition: transform var(--transition-fast);
}

.user-dropdown-container.open .user-chevron {
  transform: rotate(180deg);
}

.user-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 15rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  padding: 0.5rem;
  display: none;
  z-index: 60;
  animation: fadeInDown 0.2s ease forwards;
}

.user-menu.open {
  display: block;
}

.user-menu-header {
  padding: 0.625rem 0.875rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.375rem;
}

.user-menu-label {
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 0.25rem;
}

.user-menu-email {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.user-menu-item:hover {
  background-color: var(--bg-subtle);
  color: var(--primary-600);
}

.user-menu-item i, .user-menu-item svg {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--text-muted);
}

.user-menu-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 0.375rem 0.5rem;
}

.user-menu-logout {
  color: var(--red-600);
}

.user-menu-logout:hover {
  background-color: var(--red-50);
  color: var(--red-700);
}

.user-menu-logout i, .user-menu-logout svg {
  color: var(--red-600);
}

/* --- Main Page Container --- */
.page-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .page-content {
    padding: 1rem;
  }
}

/* Page Header */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Reusable UI Elements (Cards, Buttons, Badges) --- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: all var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-flush {
  padding: 0 !important;
  overflow: hidden;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.125rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition-normal);
  cursor: pointer;
  line-height: 1.25;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-700);
  box-shadow: 0 6px 12px -2px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--red-600);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--red-700);
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-lg);
  color: var(--text-subtle);
}

.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-active {
  background-color: var(--green-100);
  color: var(--green-700);
}

.badge-lead {
  background-color: var(--primary-100);
  color: var(--primary-700);
}

.badge-pending {
  background-color: var(--amber-100);
  color: var(--amber-700);
}

.badge-inactive {
  background-color: var(--slate-100);
  color: var(--slate-600);
}
html.dark .badge-inactive {
  background-color: var(--slate-800);
  color: var(--slate-400);
}

/* ==========================================================================
   DASHBOARD SPECIFIC STYLES
   ========================================================================== */

/* 8 Metrics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.stat-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stat-card:active {
  transform: scale(0.99);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.stat-icon-wrapper {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrapper i, .stat-icon-wrapper svg {
  width: 1.5rem;
  height: 1.5rem;
}

.stat-icon-blue {
  background-color: var(--primary-50);
  color: var(--primary-600);
}
.stat-icon-green {
  background-color: var(--green-50);
  color: var(--green-600);
}
.stat-icon-red {
  background-color: var(--red-50);
  color: var(--red-600);
}
.stat-icon-purple {
  background-color: var(--purple-50);
  color: var(--purple-600);
}
.stat-icon-orange {
  background-color: var(--orange-50);
  color: var(--orange-600);
}
.stat-icon-brown {
  background-color: var(--slate-100);
  color: #78716c;
}
html.dark .stat-icon-brown {
  background-color: rgba(120, 113, 108, 0.2);
  color: #a8a29e;
}
.stat-icon-indigo {
  background-color: var(--indigo-50);
  color: var(--indigo-600);
}

.stat-card-more {
  color: var(--text-subtle);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.stat-card-more:hover {
  color: var(--text-secondary);
}

.stat-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-card-value {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color var(--transition-fast);
}

.stat-card:hover .stat-card-sub {
  color: var(--text-secondary);
}

/* Charts & Activity Layout */
.dashboard-grid-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 1024px) {
  .dashboard-grid-main {
    grid-template-columns: 2fr 1fr;
  }
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.chart-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-select {
  padding: 0.375rem 0.75rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
}

.chart-container-large {
  position: relative;
  height: 380px;
  width: 100%;
}

.chart-container-donut {
  position: relative;
  height: 290px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container-bar {
  position: relative;
  height: 290px;
  width: 100%;
}

/* Recent Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.activity-item {
  display: flex;
  gap: 1rem;
  position: relative;
}

.activity-timeline-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.25rem;
}

.activity-dot {
  width: 0.625rem;
  height: 0.625rem;
  background-color: var(--primary-500);
  border-radius: var(--radius-full);
  z-index: 2;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.activity-line {
  position: absolute;
  top: 0.625rem;
  width: 2px;
  height: calc(100% + 1.5rem);
  background-color: var(--border-subtle);
  z-index: 1;
}

.activity-item:last-child .activity-line {
  display: none;
}

.activity-details {
  flex: 1;
}

.activity-action {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.activity-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.activity-view-all-btn {
  width: 100%;
  margin-top: 2rem;
  padding: 0.625rem;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-600);
  text-align: center;
  transition: all var(--transition-fast);
}

.activity-view-all-btn:hover {
  background-color: var(--primary-50);
}
html.dark .activity-view-all-btn:hover {
  background-color: rgba(59, 130, 246, 0.15);
}

/* Lower Charts Grid */
.dashboard-grid-lower {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .dashboard-grid-lower {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   CUSTOMERS PAGE SPECIFIC STYLES
   ========================================================================== */

/* Customers Filter Toolbar */
.table-toolbar {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .table-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.table-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
}

.table-search-wrapper .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.table-search-input {
  width: 100%;
  height: 2.375rem;
  padding: 0 1rem 0 2.5rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-normal);
}

.table-search-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.table-filter-select {
  padding: 0.5rem 0.875rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
}

/* Table Responsive Structure */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background-color: var(--bg-subtle);
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover td {
  background-color: var(--bg-subtle);
}

/* Table Cells */
.customer-cell {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.customer-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background-color: var(--primary-100);
  color: var(--primary-600);
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.customer-avatar:hover {
  transform: scale(1.1);
}

.customer-name {
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.customer-name:hover {
  color: var(--primary-600);
}

.customer-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.contact-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.contact-item i, .contact-item svg {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-subtle);
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  color: var(--text-subtle);
  transition: all var(--transition-fast);
}

.action-btn.edit-btn:hover {
  background-color: var(--primary-50);
  color: var(--primary-600);
}

.action-btn.delete-btn:hover {
  background-color: var(--red-50);
  color: var(--red-600);
}

/* Pagination Bar */
.pagination-container {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.pagination-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.pagination-controls {
  display: inline-flex;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.pagination-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-right: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.pagination-btn:last-child {
  border-right: none;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--bg-subtle);
}

.pagination-btn.active {
  background-color: var(--primary-600);
  color: #ffffff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.modal-overlay.open,
.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  position: relative;
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-overlay.open .modal-dialog,
.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-lg);
  color: var(--text-subtle);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.form-label i, .form-label svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary-500);
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-section-title {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* Delete Confirmation Modal Specifics */
.delete-modal-dialog {
  max-width: 440px;
  text-align: center;
  padding: 2rem;
}

.delete-icon-box {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-2xl);
  background-color: var(--red-50);
  color: var(--red-600);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.delete-icon-box i, .delete-icon-box svg {
  width: 2rem;
  height: 2rem;
}

.delete-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.delete-modal-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.delete-modal-text strong {
  color: var(--text-primary);
}

.delete-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Customer Drill-down Modal (Grand Details View) */
.customer-details-dialog {
  max-width: 900px;
  border-radius: 2.5rem;
  overflow: hidden;
}

.details-banner {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  padding: 2rem 2rem 6.5rem;
  position: relative;
  color: #ffffff;
}

.details-banner-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}

.details-banner-close:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.details-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.details-hero-avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 1.75rem;
  background-color: #ffffff;
  color: var(--primary-600);
  font-weight: 900;
  font-size: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.details-hero-name {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.details-hero-tags {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.details-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.details-content-wrapper {
  margin-top: -5rem;
  padding: 0 2rem 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  position: relative;
  z-index: 10;
}

@media (min-width: 1024px) {
  .details-content-wrapper {
    grid-template-columns: 4fr 8fr;
  }
}

.details-sidebar-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.details-info-tile {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.details-tile-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-lg);
  background-color: var(--primary-100);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
}

.details-tile-label {
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

.details-tile-val {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.details-stat-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  text-align: center;
}

.details-stat-item {
  padding: 0.875rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.details-stat-num {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
}

/* Tabs inside drill-down */
.details-tabs-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.details-tabs-header {
  display: flex;
  padding: 0.5rem;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.5rem;
}

.details-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem;
  border-radius: var(--radius-xl);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  transition: all var(--transition-fast);
}

.details-tab-btn.active {
  background-color: var(--bg-surface);
  color: var(--primary-600);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-color);
}

.details-tab-body {
  padding: 1.5rem;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.record-row:hover {
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-xl);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s, transform 0.3s;
}

.toast-success .toast-icon {
  color: var(--green-600);
}

.toast-error .toast-icon {
  color: var(--red-600);
}

/* Keyframe Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulseGlow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Responsive Breakpoints & Mobile Sidebar Toggle */
@media (max-width: 1023px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close-btn {
    display: flex;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }
}

/* ==========================================================================
   AUTHENTICATION PAGES (Login, Role Selector)
   ========================================================================== */
.auth-wrapper {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 10%, rgba(59, 130, 246, 0.08) 0%, transparent 60%), var(--bg-body);
  position: relative;
  overflow: hidden;
}

.auth-ambient-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, transparent 70%);
  top: -150px;
  right: -100px;
  pointer-events: none;
  filter: blur(40px);
}

.auth-ambient-glow-2 {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  pointer-events: none;
  filter: blur(40px);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-2xl);
  padding: 2.5rem;
  position: relative;
  z-index: 10;
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #ffffff;
  border-radius: var(--radius-xl);
  font-weight: 800;
  font-size: 1.75rem;
  box-shadow: var(--shadow-primary);
  margin-bottom: 1.25rem;
}

.auth-title {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-roles-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-tag-admin {
  background-color: var(--primary-50);
  color: var(--primary-600);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.role-tag-manager {
  background-color: var(--purple-50);
  color: var(--purple-600);
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.role-tag-dsr {
  background-color: var(--green-50);
  color: var(--green-600);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.auth-quick-fill {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.875rem;
  margin-bottom: 1.5rem;
}

.quick-fill-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-fill-btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.quick-fill-btn {
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-fill-btn:hover {
  background-color: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
  transform: translateY(-1px);
}

.auth-form-group {
  margin-bottom: 1.25rem;
}

.auth-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 0.875rem;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.auth-input {
  width: 100%;
  height: 2.875rem;
  padding: 0 2.75rem 0 2.75rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-normal);
}

.auth-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.auth-input-toggle {
  position: absolute;
  right: 0.875rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  cursor: pointer;
  border-radius: var(--radius-md);
}

.auth-input-toggle:hover {
  color: var(--text-primary);
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary-600);
  cursor: pointer;
}

.auth-submit-btn {
  width: 100%;
  height: 2.875rem;
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-xl);
  background-color: var(--primary-600);
  color: #ffffff;
  box-shadow: var(--shadow-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.auth-submit-btn:hover {
  background-color: var(--primary-700);
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  animation: fadeInDown 0.2s ease;
}

.auth-alert-error {
  background-color: var(--red-50);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red-700);
}

.auth-alert-success {
  background-color: var(--green-50);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green-700);
}

.auth-theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
}
