/* ============================================
   CleverROI v5 – Premium Cognitive UI
   Modern · HD · Notebook ML Feel
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
  /* Base – clean, light, premium */
  --bg-body: #f9fafc;           /* very light gray-blue – easy on eyes */
  --bg-surface: #ffffff;         /* pure white for cards */
  --bg-surface-subtle: #f2f4f8;  /* subtle gray for secondary surfaces */
  --bg-sidebar: #ffffff;         /* white sidebar with subtle separation */
  --border-light: #e9edf2;
  --border-strong: #d0d7de;

  /* Text – high contrast, readable */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-disabled: #94a3b8;

  /* Accent colors – clean, meaningful */
  --accent-primary: #3b82f6;     /* vibrant blue – primary actions */
  --accent-success: #10b981;     /* emerald – high score, verified */
  --accent-warning: #f59e0b;     /* amber – medium, warm lead */
  --accent-danger: #ef4444;      /* red – risk, fraud */
  --accent-info: #8b5cf6;        /* purple – AI insights */

  /* Gradients – subtle, modern */
  --gradient-card: linear-gradient(145deg, #ffffff, #f9fafc);
  --gradient-header: linear-gradient(135deg, #f8fafc, #f1f5f9);

  /* Shadows – soft, depth */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 20px 24px -8px rgba(0, 0, 0, 0.06), 0 8px 8px -4px rgba(0, 0, 0, 0.02);
  --shadow-xl: 0 32px 48px -12px rgba(0, 0, 0, 0.08);

  /* Border radius – refined */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --header-height: 64px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 0.9375rem;
  min-height: 100vh;
  display: flex;
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ---------- Sidebar – clean, premium ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: var(--space-5) var(--space-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width var(--transition-base);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  padding: 0 var(--space-2);
}

.logo-full img {
  height: 36px;
  width: auto;
}

.logo-icon i {
  font-size: 2rem;
  color: var(--accent-primary);
}

.sidebar.collapsed .logo-full { display: none; }
.sidebar.collapsed .logo-icon { display: flex; }
.sidebar:not(.collapsed) .logo-icon { display: none; }

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.toggle-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--accent-primary);
}
.toggle-btn i {
  transition: transform var(--transition-base);
}
.sidebar.collapsed .toggle-btn i {
  transform: rotate(180deg);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  white-space: nowrap;
}
.sidebar-nav a i {
  width: 20px;
  font-size: 1.1rem;
  color: var(--text-muted);
}
.sidebar-nav a:hover {
  background: var(--bg-surface-subtle);
  color: var(--accent-primary);
}
.sidebar-nav a:hover i {
  color: var(--accent-primary);
}
.sidebar-nav a.active {
  background: var(--bg-surface-subtle);
  color: var(--accent-primary);
  font-weight: 600;
  border-left: 3px solid var(--accent-primary);
}
.sidebar-nav a.active i {
  color: var(--accent-primary);
}

.sidebar.collapsed .sidebar-nav a span {
  display: none;
}
.sidebar.collapsed .sidebar-nav a {
  justify-content: center;
  padding: var(--space-3) 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  padding: var(--space-6) var(--space-8);
  transition: var(--transition-base);
  max-width: calc(100vw - var(--sidebar-width));
  background: var(--bg-body);
}
.sidebar.collapsed + .main-content {
  max-width: calc(100vw - var(--sidebar-collapsed));
}

.page-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  letter-spacing: -0.01em;
}

/* ---------- Header Stats Bar – cognitive, compact ---------- */
.header-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg-surface);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.usage-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-surface-subtle);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.usage-badge i {
  color: var(--accent-primary);
}

.usage-bar {
  width: 80px;
  height: 4px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

.user-menu .btn-icon {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
}
.user-menu .btn-icon:hover {
  background: var(--bg-surface);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.dropdown-menu {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.dropdown-menu a {
  color: var(--text-secondary);
}
.dropdown-menu a:hover {
  background: var(--bg-surface-subtle);
  color: var(--accent-primary);
}
.dropdown-menu hr {
  border-color: var(--border-light);
}

/* ---------- Cards – premium, cognitive ---------- */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: var(--transition-fast);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card-header h3 i {
  color: var(--accent-primary);
  font-size: 1rem;
}

/* Accent border for signal */
.card-accent {
  border-left: 4px solid transparent;
}
.card-accent.high { border-left-color: var(--accent-success); }
.card-accent.medium { border-left-color: var(--accent-warning); }
.card-accent.low { border-left-color: var(--accent-danger); }

/* ---------- Stats Grid – cognitive HD ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.stat-card .label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.stat-card .value {
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-card small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ---------- Badges / Chips – clean, semantic ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.badge i {
  font-size: 0.7rem;
}

/* Semantic variants */
.badge.success { background: rgba(16, 185, 129, 0.08); color: var(--accent-success); border-color: rgba(16, 185, 129, 0.15); }
.badge.warning { background: rgba(245, 158, 11, 0.08); color: var(--accent-warning); border-color: rgba(245, 158, 11, 0.15); }
.badge.danger { background: rgba(239, 68, 68, 0.08); color: var(--accent-danger); border-color: rgba(239, 68, 68, 0.15); }
.badge.info { background: rgba(139, 92, 246, 0.08); color: var(--accent-info); border-color: rgba(139, 92, 246, 0.15); }
.badge.primary { background: rgba(59, 130, 246, 0.08); color: var(--accent-primary); border-color: rgba(59, 130, 246, 0.15); }

/* Grade compatibility */
.badge.hot { background: rgba(239, 68, 68, 0.08); color: var(--accent-danger); border-color: rgba(239, 68, 68, 0.15); }
.badge.warm { background: rgba(245, 158, 11, 0.08); color: var(--accent-warning); border-color: rgba(245, 158, 11, 0.15); }
.badge.mild { background: rgba(245, 158, 11, 0.04); color: var(--accent-warning); border-color: rgba(245, 158, 11, 0.1); }
.badge.cold { background: rgba(139, 92, 246, 0.08); color: var(--accent-info); border-color: rgba(139, 92, 246, 0.15); }

/* Status pipeline */
.badge.status-new { background: rgba(59, 130, 246, 0.08); color: var(--accent-primary); border-color: rgba(59, 130, 246, 0.15); }
.badge.status-contacted { background: rgba(139, 92, 246, 0.08); color: var(--accent-info); border-color: rgba(139, 92, 246, 0.15); }
.badge.status-qualified { background: rgba(16, 185, 129, 0.08); color: var(--accent-success); border-color: rgba(16, 185, 129, 0.15); }
.badge.status-proposal-sent { background: rgba(245, 158, 11, 0.08); color: var(--accent-warning); border-color: rgba(245, 158, 11, 0.15); }
.badge.status-closed-won { background: rgba(16, 185, 129, 0.08); color: var(--accent-success); border-color: rgba(16, 185, 129, 0.15); }
.badge.status-closed-lost { background: rgba(239, 68, 68, 0.08); color: var(--accent-danger); border-color: rgba(239, 68, 68, 0.15); }

/* ---------- Score Gauge – prominent ---------- */
.score-gauge {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-primary) 0deg 180deg, var(--border-light) 180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  flex-shrink: 0;
}
.score-circle::before {
  content: '';
  width: 100px;
  height: 100px;
  background: var(--bg-surface);
  border-radius: 50%;
  position: absolute;
}
.score-circle span {
  position: relative;
  z-index: 2;
}

/* ---------- Buttons – clean, modern ---------- */
.btn {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  line-height: 1;
}
.btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-primary {
  background: var(--accent-primary);
  color: white;
  border: none;
}
.btn-primary:hover {
  background: #2563eb;
}
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.8rem;
}
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-surface-subtle);
  color: var(--accent-primary);
}

/* ---------- Forms – clean, functional ---------- */
.form-group {
  margin-bottom: var(--space-4);
}
label {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}
input, select, textarea {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  width: 100%;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--bg-surface);
}

/* ---------- Tables – premium, scannable ---------- */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--space-2);
}
.premium-table th {
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.premium-table td {
  background: var(--bg-surface);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.premium-table tr:hover td {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* ---------- Kanban – cognitive pipeline ---------- */
.kanban-board {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
}
.kanban-column {
  flex: 0 0 300px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}
.column-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.status-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.column-count {
  background: var(--bg-surface-subtle);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--text-muted);
}
.column-cards {
  flex: 1;
  min-height: 200px;
}
.kanban-card {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  cursor: grab;
  border-left: 4px solid transparent;
}
.kanban-card[data-risk="High"] { border-left-color: var(--accent-danger); }
.kanban-card[data-risk="Medium"] { border-left-color: var(--accent-warning); }
.kanban-card[data-risk="Low"] { border-left-color: var(--accent-success); }
.kanban-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.card-actions {
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.kanban-card:hover .card-actions {
  opacity: 1;
}
.card-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--space-1);
}
.card-details {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2);
  font-size: 0.7rem;
}
.score-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
}

/* ---------- Slider (Explain) – premium overlay ---------- */
.slider-panel {
  position: fixed;
  top: 0;
  right: -45%;
  width: 45%;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xl);
  transition: right var(--transition-slow);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-light);
}
.slider-panel.open {
  right: 0;
}
.slider-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.slider-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}
.slider-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}
.slider-body {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}
.slider-section {
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-light);
}
.slider-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.slider-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.slider-info-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.slider-info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-4);
}
.tab {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.tab:hover {
  color: var(--text-primary);
}
.tab.active {
  border-bottom-color: var(--accent-primary);
  color: var(--accent-primary);
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* ---------- Modals – clean, focused ---------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal-container {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
}
.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: 1.2rem;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-body {
  padding: var(--space-6);
}
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ---------- Toast Notifications ---------- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
}
.toast {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideUp var(--transition-slow);
  border: 1px solid var(--border-light);
}
.toast.success { border-left-color: var(--accent-success); }
.toast.error { border-left-color: var(--accent-danger); }
.toast.warning { border-left-color: var(--accent-warning); }
.toast.info { border-left-color: var(--accent-info); }
.toast i { font-size: 1.1rem; }
.toast .message { flex: 1; color: var(--text-primary); }
.toast .close { cursor: pointer; color: var(--text-muted); }
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Utilities ---------- */
.flex { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-accent { color: var(--accent-primary); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .slider-panel {
    width: 80%;
    right: -80%;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 100;
    transition: left var(--transition-base);
  }
  .sidebar.open {
    left: 0;
  }
  .main-content {
    max-width: 100%;
    padding: var(--space-4);
  }
  .header-stats {
    flex-direction: column;
    align-items: stretch;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .kanban-board {
    flex-direction: column;
  }
  .kanban-column {
    flex: 1 1 auto;
  }
}
/* ============================================
   Lead Inbox – Detail Panel (Premium)
   ============================================ */
.detail-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 450px;
    height: 100vh;
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-slow);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-light);
}
.detail-panel.open {
    right: 0;
}
.detail-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detail-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}
.detail-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}
.detail-close:hover {
    background: var(--bg-surface-subtle);
    color: var(--accent-danger);
}
.detail-body {
    flex: 1;
    padding: var(--space-6);
    overflow-y: auto;
}
.detail-section {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}
.detail-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.detail-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: var(--space-3);
}
.detail-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}
.detail-meta {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
}
.detail-grid div {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.detail-grid i {
    width: 20px;
    color: var(--text-muted);
}
.detail-message {
    background: var(--bg-surface-subtle);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    white-space: pre-wrap;
}
.detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.detail-stats > div {
    background: var(--bg-surface-subtle);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    text-align: center;
}
.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.detail-reasons ul {
    margin-top: var(--space-2);
    padding-left: var(--space-5);
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.detail-notes {
    background: var(--bg-surface-subtle);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.detail-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
    flex-wrap: wrap;
}
@media (max-width: 768px) {
    .detail-panel {
        width: 100%;
        right: -100%;
    }
}