/* ==========================================================================
   MARBAY CRM - MODERN DESIGN SYSTEM & THEME
   Tailored Glassmorphism, Micro-interactions, Responsive Layout & Dark Slate Accents
   ========================================================================== */

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

:root {
  /* Brand Palette */
  --crm-primary: #6366f1;
  --crm-primary-hover: #4f46e5;
  --crm-primary-light: #e0e7ff;
  --crm-primary-dark: #3730a3;
  --crm-primary-glow: rgba(99, 102, 241, 0.25);

  --crm-secondary: #0ea5e9;
  --crm-accent: #8b5cf6;
  --crm-emerald: #10b981;
  --crm-emerald-light: #d1fae5;
  --crm-amber: #f59e0b;
  --crm-amber-light: #fef3c7;
  --crm-rose: #f43f5e;
  --crm-rose-light: #ffe4e6;

  /* Surfaces & Backgrounds */
  --crm-bg-main: #f8fafc;
  --crm-bg-card: #ffffff;
  --crm-bg-sidebar: #0f172a;
  --crm-bg-sidebar-hover: #1e293b;
  --crm-bg-sidebar-active: #334155;
  
  /* Text & Borders */
  --crm-text-main: #0f172a;
  --crm-text-muted: #64748b;
  --crm-text-light: #94a3b8;
  --crm-border: #e2e8f0;
  --crm-border-focus: #a5b4fc;
  
  /* Shadows & Glass */
  --crm-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --crm-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --crm-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --crm-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --crm-shadow-glow: 0 0 20px var(--crm-primary-glow);
  
  --crm-radius-sm: 0.375rem;
  --crm-radius-md: 0.625rem;
  --crm-radius-lg: 1rem;
  --crm-radius-xl: 1.5rem;
  --crm-radius-full: 9999px;
  
  --sidebar-width: 270px;
  --header-height: 70px;
  --transition-speed: 0.2s;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--crm-bg-main);
  color: var(--crm-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.crm-app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.crm-sidebar {
  width: var(--sidebar-width);
  background: var(--crm-bg-sidebar);
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  overflow-y: auto;
}

.crm-sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--crm-radius-md);
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--crm-primary-glow);
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
}

.crm-brand-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: var(--crm-radius-md);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.crm-brand-icon-wrapper:hover {
  transform: scale(1.05);
}

.crm-brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.crm-brand-text {
  display: flex;
  flex-direction: column;
}

.crm-brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.crm-brand-subtitle {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--crm-primary-light);
  font-weight: 600;
}

.crm-sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.crm-nav-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--crm-text-light);
  padding: 0.75rem 0.875rem 0.375rem;
  font-weight: 700;
}

.crm-nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--crm-radius-md);
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  position: relative;
}

.crm-nav-item:hover {
  background: var(--crm-bg-sidebar-hover);
  color: #ffffff;
  transform: translateX(3px);
}

.crm-nav-item.active {
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 14px var(--crm-primary-glow);
  font-weight: 600;
}

.crm-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crm-nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--crm-radius-full);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
}

.crm-sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  background: rgba(0, 0, 0, 0.15);
}

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

/* Top Header */
.crm-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--crm-border);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.crm-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.crm-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--crm-text-main);
  border-radius: var(--crm-radius-sm);
}

.crm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--crm-text-muted);
}

.crm-breadcrumb-separator {
  color: var(--crm-text-light);
}

.crm-breadcrumb-current {
  color: var(--crm-text-main);
  font-weight: 600;
}

.crm-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.crm-header-action-btn {
  background: none;
  border: 1px solid var(--crm-border);
  width: 40px;
  height: 40px;
  border-radius: var(--crm-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--crm-text-muted);
  position: relative;
  transition: all var(--transition-speed);
}

.crm-header-action-btn:hover {
  background: #f1f5f9;
  color: var(--crm-text-main);
  border-color: #cbd5e1;
}

.crm-notif-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--crm-rose);
  border: 2px solid #fff;
}

/* User Menu in Header */
.crm-user-dropdown {
  position: relative;
  display: inline-block;
}

.crm-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--crm-radius-full);
  transition: background var(--transition-speed);
}

.crm-user-trigger:hover {
  background: #f1f5f9;
}

.crm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--crm-shadow-sm);
  flex-shrink: 0;
}

.crm-user-info-text {
  text-align: left;
  line-height: 1.2;
}

.crm-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--crm-text-main);
}

.crm-user-role-label {
  font-size: 0.75rem;
  color: var(--crm-text-muted);
}

/* Page Body Container */
.crm-content {
  padding: 2rem;
  flex: 1;
}

.crm-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.crm-page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

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

.crm-page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   CARDS & STATS
   ========================================================================== */

.crm-card {
  background: var(--crm-bg-card);
  border-radius: var(--crm-radius-lg);
  border: 1px solid var(--crm-border);
  box-shadow: var(--crm-shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-speed) ease, transform var(--transition-speed) ease;
}

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

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

.crm-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--crm-text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crm-card-body {
  padding: 1.5rem;
}

/* Stat Widgets */
.crm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.crm-stat-card {
  background: var(--crm-bg-card);
  border-radius: var(--crm-radius-lg);
  border: 1px solid var(--crm-border);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--crm-shadow-sm);
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--crm-shadow-lg);
}

.crm-stat-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: var(--crm-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}

.crm-stat-icon-indigo {
  background: #eef2ff;
  color: var(--crm-primary);
}

.crm-stat-icon-emerald {
  background: var(--crm-emerald-light);
  color: var(--crm-emerald);
}

.crm-stat-icon-amber {
  background: var(--crm-amber-light);
  color: var(--crm-amber);
}

.crm-stat-icon-purple {
  background: #f3e8ff;
  color: var(--crm-accent);
}

.crm-stat-content {
  flex: 1;
}

.crm-stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--crm-text-main);
}

.crm-stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--crm-text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */

.crm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--crm-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  white-space: nowrap;
}

.crm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.crm-btn-primary {
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 12px var(--crm-primary-glow);
}

.crm-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--crm-primary-hover), var(--crm-primary-dark));
  box-shadow: 0 6px 16px var(--crm-primary-glow);
  transform: translateY(-1px);
}

.crm-btn-secondary {
  background: #f1f5f9;
  color: var(--crm-text-main);
  border-color: var(--crm-border);
}

.crm-btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
  color: #000;
}

.crm-btn-danger {
  background: var(--crm-rose);
  color: #fff;
}

.crm-btn-danger:hover:not(:disabled) {
  background: #e11d48;
}

.crm-btn-outline-danger {
  background: transparent;
  border-color: #fecdd3;
  color: var(--crm-rose);
}

.crm-btn-outline-danger:hover:not(:disabled) {
  background: var(--crm-rose-light);
  border-color: var(--crm-rose);
}

.crm-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--crm-radius-sm);
}

/* ==========================================================================
   TABLES & DATA LISTS
   ========================================================================== */

.crm-table-container {
  width: 100%;
  overflow-x: auto;
}

.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.crm-table th {
  background: #f8fafc;
  color: var(--crm-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--crm-border);
}

.crm-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--crm-border);
  font-size: 0.875rem;
  color: var(--crm-text-main);
  vertical-align: middle;
}

.crm-table tbody tr {
  transition: background-color var(--transition-speed);
}

.crm-table tbody tr:hover {
  background-color: #f8fafc;
}

.crm-table tbody tr:last-child td {
  border-bottom: none;
}

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

.crm-badge-super-admin {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}

.crm-badge-admin {
  background: #eef2ff;
  color: var(--crm-primary);
  border: 1px solid #c7d2fe;
}

.crm-badge-manager {
  background: #f3e8ff;
  color: var(--crm-accent);
  border: 1px solid #e9d5ff;
}

.crm-badge-csm {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.crm-badge-csa {
  background: #f0fdfa;
  color: #0d9488;
  border: 1px solid #99f6e4;
}

.crm-badge-marketing-mgr {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

.crm-badge-sr-marketing {
  background: #fefce8;
  color: #ca8a04;
  border: 1px solid #fef08a;
}

.crm-badge-marketing {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.crm-badge-recovery {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.crm-badge-active {
  background: var(--crm-emerald-light);
  color: #065f46;
}

.crm-badge-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.crm-badge-warning,
.crm-badge-impersonate {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */

.crm-form-group {
  margin-bottom: 1.5rem;
}

.crm-label, .crm-form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--crm-text-main);
  margin-bottom: 0.5rem;
}

.crm-input, .crm-select, .crm-textarea, .crm-form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--crm-text-main);
  background-color: #fff;
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-radius-md);
  transition: all var(--transition-speed);
}

.crm-input:focus, .crm-select:focus, .crm-textarea:focus, .crm-form-control:focus {
  outline: none;
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px var(--crm-primary-glow);
}

.crm-form-error {
  color: var(--crm-rose);
  font-size: 0.78rem;
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Filter Grid & Multi-column Filter Forms */
.crm-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.crm-filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--crm-border);
}

@media (max-width: 992px) {
  .crm-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .crm-filter-grid {
    grid-template-columns: 1fr;
  }
  .crm-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .crm-filter-actions > div {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Permission Matrix */
.crm-permission-module {
  background: #f8fafc;
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.crm-permission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--crm-border);
}

.crm-module-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--crm-text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crm-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.875rem;
}

.crm-perm-card {
  background: #ffffff;
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-radius-md);
  padding: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.crm-perm-card:hover {
  border-color: var(--crm-primary-light);
  box-shadow: var(--crm-shadow-sm);
}

.crm-perm-card input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
  accent-color: var(--crm-primary);
  cursor: pointer;
}

.crm-perm-info {
  flex: 1;
}

.crm-perm-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--crm-text-main);
}

.crm-perm-desc {
  font-size: 0.75rem;
  color: var(--crm-text-muted);
  margin-top: 0.15rem;
}

/* Alerts & Notifications */
.crm-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--crm-radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.crm-alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.crm-alert-danger {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.crm-alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ==========================================================================
   AUTH SCREEN (LOGIN) - CREATIVE GLASSMORPHISM
   ========================================================================== */

.crm-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgb(15, 23, 42) 0%, rgb(30, 41, 59) 90%);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.crm-auth-decor-1 {
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, rgba(99, 102, 241, 0) 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.crm-auth-decor-2 {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0) 70%);
  bottom: -150px;
  left: -150px;
  border-radius: 50%;
  pointer-events: none;
}

.crm-auth-card {
  width: 100%;
  max-width: 450px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--crm-radius-xl);
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 10;
}

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

.crm-auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--crm-radius-lg);
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-accent));
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
  box-shadow: 0 8px 20px var(--crm-primary-glow);
  margin-bottom: 1.25rem;
}

.crm-auth-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: var(--crm-radius-xl);
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.25rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.crm-auth-logo-wrapper:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.crm-auth-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.crm-auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

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

.crm-auth-demo-box {
  margin-top: 1.5rem;
  background: #f8fafc;
  border: 1px dashed var(--crm-border);
  border-radius: var(--crm-radius-md);
  padding: 0.875rem;
  font-size: 0.78rem;
  color: var(--crm-text-muted);
}

.crm-auth-demo-box strong {
  color: var(--crm-text-main);
}

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */

@media (max-width: 1024px) {
  .crm-sidebar {
    transform: translateX(-100%);
  }

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

  .crm-main-area {
    margin-left: 0;
  }

  .crm-mobile-toggle {
    display: block;
  }

  .crm-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 45;
  }
}

@media (max-width: 640px) {
  .crm-header {
    padding: 0 1rem;
  }
  
  .crm-content {
    padding: 1rem;
  }

  .crm-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SWEETALERT2 MODERN SLIDE TOAST NOTIFICATIONS
   ========================================================================== */

body.swal2-toast-shown .swal2-container.swal2-top-end,
body.swal2-toast-shown .swal2-container {
  inset: 1.5rem 1.5rem auto auto !important;
  top: 1.5rem !important;
  right: 1.5rem !important;
  bottom: auto !important;
  left: auto !important;
  width: 400px !important;
  max-width: calc(100vw - 3rem) !important;
  overflow: visible !important;
  padding: 0 !important;
  z-index: 999999 !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast {
  display: grid !important;
  grid-template-columns: 36px 1fr auto !important;
  align-items: center !important;
  column-gap: 0.85rem !important;
  row-gap: 0.2rem !important;
  box-sizing: border-box !important;
  width: 380px !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.9rem 1rem !important;
  background: #ffffff !important;
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04) !important;
  position: relative !important;
  overflow: hidden !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-show {
  animation: crmToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-hide {
  animation: crmToastOut 0.25s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast:hover {
  box-shadow: 0 16px 32px -6px rgba(15, 23, 42, 0.14), 0 8px 16px -6px rgba(15, 23, 42, 0.06) !important;
  transform: translateY(-2px);
}

@keyframes crmToastIn {
  0% {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes crmToastOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

/* Left Accent Indicator Border */
body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-warning {
  border-left: 4px solid #f59e0b !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-error {
  border-left: 4px solid #ef4444 !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-success {
  border-left: 4px solid #10b981 !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-info {
  border-left: 4px solid #6366f1 !important;
}

/* Refined Compact Icon Pill */
body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  align-self: center !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon .swal2-icon-content {
  font-family: inherit !important;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-warning {
  background: #fef3c7 !important;
  color: #d97706 !important;
  border: 1.5px solid #fde68a !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-success {
  background: #d1fae5 !important;
  color: #059669 !important;
  border: 1.5px solid #a7f3d0 !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-error {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1.5px solid #fecaca !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-info {
  background: #e0e7ff !important;
  color: #4f46e5 !important;
  border: 1.5px solid #c7d2fe !important;
}

/* Replace internal SVG animation lines on success / error with clean glyphs */
body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-success [class^='swal2-success-line'],
body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring {
  display: none !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-icon-content::before {
  content: '✓';
  font-weight: 800;
  font-size: 1.15rem;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
  display: none !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-icon.swal2-error .swal2-icon-content::before {
  content: '✕';
  font-weight: 800;
  font-size: 1.05rem;
}

/* Toast Title & Message Typography */
body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-title {
  grid-column: 2 !important;
  grid-row: 1 !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.3 !important;
  margin: 0 !important;
  padding: 0 !important;
  letter-spacing: -0.01em !important;
  text-align: left !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-html-container {
  grid-column: 2 !important;
  grid-row: 2 !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  color: #64748b !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

/* Minimalist Close Button */
body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-close {
  grid-column: 3 !important;
  grid-row: 1 / span 2 !important;
  align-self: center !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 6px !important;
  color: #94a3b8 !important;
  font-size: 1.15rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  transition: all 0.15s ease !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-close:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}

/* Timer Progress Bar */
body.swal2-toast-shown .swal2-popup.swal2-toast .swal2-timer-progress-bar {
  height: 3px !important;
  bottom: 0 !important;
  border-radius: 0 0 12px 12px !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-warning .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-success .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #10b981, #059669) !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-error .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
}

body.swal2-toast-shown .swal2-popup.swal2-toast.swal2-icon-info .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #6366f1, #4f46e5) !important;
}

/* ==========================================================================
   CRM MODERN PAGINATION
   ========================================================================== */
.crm-pagination-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

.crm-pagination-info {
  font-size: 0.85rem;
  color: var(--crm-text-muted, #64748b);
  font-weight: 500;
}

.crm-pagination-info strong,
.crm-pagination-info span.font-medium {
  color: var(--crm-text-main, #0f172a);
  font-weight: 700;
}

.crm-pagination-links {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.crm-pagination-item {
  display: inline-flex;
}

.crm-pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  border: 1px solid var(--crm-border, #e2e8f0);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
}

.crm-pagination-link:hover:not(.disabled):not(.active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--crm-primary-hover, #4f46e5);
}

.crm-pagination-link.active {
  background: var(--crm-primary, #6366f1);
  border-color: var(--crm-primary, #6366f1);
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.25);
  font-weight: 700;
  cursor: default;
}

.crm-pagination-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: var(--crm-border, #e2e8f0);
  color: #94a3b8;
}

.crm-pagination-link svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0;
  vertical-align: middle;
}

.crm-pagination-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 36px;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Global Safety: Never let pagination SVGs balloon */
nav[role="navigation"] svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: inline-block !important;
}
