/* ============================================
   PPS OneDesk — Design System
   Business Operating System
   ============================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
  /* Core Palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-surface: #1a2035;
  --bg-surface-hover: #1f2a45;
  --bg-surface-active: #253050;

  /* Accent Colors */
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-blue-soft: rgba(59, 130, 246, 0.15);
  --accent-green: #10b981;
  --accent-green-soft: rgba(16, 185, 129, 0.15);
  --accent-yellow: #f59e0b;
  --accent-yellow-soft: rgba(245, 158, 11, 0.15);
  --accent-red: #ef4444;
  --accent-red-soft: rgba(239, 68, 68, 0.15);
  --accent-purple: #8b5cf6;
  --accent-purple-soft: rgba(139, 92, 246, 0.15);
  --accent-cyan: #06b6d4;
  --accent-cyan-soft: rgba(6, 182, 212, 0.15);
  --accent-orange: #f97316;
  --accent-orange-soft: rgba(249, 115, 22, 0.15);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Borders */
  --border-default: #1e293b;
  --border-light: #334155;
  --border-focus: var(--accent-blue);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* --- Design System Upgrade --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;

  --elevation-1: 0 2px 6px rgba(0,0,0,0.25);
  --elevation-2: 0 6px 18px rgba(0,0,0,0.35);
  --elevation-3: 0 12px 32px rgba(0,0,0,0.45);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-blue-hover); }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- App Layout --- */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- Loading Screen --- */
.loader-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  gap: 1rem;
}

/* --- iOS Style Toggle Switch --- */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
  background-color: #10b981;
}
input:checked + .slider:before {
  transform: translateX(20px);
}
input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.loader-screen .loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-screen .loader-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Global Centered Loader --- */
.loading-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  width: 100%;
  gap: 1.5rem;
  padding: 3rem;
}

.premium-loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--accent-blue-soft);
  border-bottom-color: var(--accent-blue);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-brand {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: white;
}

.sidebar-brand .brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-brand .brand-text span {
  color: var(--accent-blue);
}

/* --- Logo Styling --- */
.logo-main {
  height: 120px; /* Increased from 80px */
  width: auto;
  object-fit: contain;
  margin-bottom: 2.5rem;
  filter: invert(1) hue-rotate(180deg) brightness(1.3) contrast(1.2);
  mix-blend-mode: screen;
}

.sidebar-logo {
  height: 56px; /* Increased from 48px */
  width: auto;
  object-fit: contain;
  transition: transform var(--transition-normal);
  /* Magic CSS to remove white background on dark theme */
  filter: invert(1) hue-rotate(180deg) brightness(1.3) contrast(1.2);
  mix-blend-mode: screen;
}

.sidebar-logo:hover {
  transform: scale(1.05);
}

.bg-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%; /* Increased from 80% */
  height: 90%; /* Increased from 80% */
  z-index: -1;
  opacity: 0.08; /* Slightly increased for better visibility as watermark */
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: grayscale(1) contrast(1.2); /* Make it look more like a subtle watermark */
}

.bg-watermark img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-section-title {
  padding: 1rem 1.5rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  user-select: none;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-surface-active);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.nav-item.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.nav-item .coming-soon-tag {
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* User Profile in Sidebar */
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-info .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info .user-role {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-blue);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.logout-btn:hover {
  background: var(--accent-red-soft);
}

/* --- Main Content Area --- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Page Header */
.page-header {
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 2rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.page-header .page-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.page-header .page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.page-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-header .header-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Content Area */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
}

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

/* --- Stat Cards Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-card .stat-change {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.stat-card .stat-change.positive { color: var(--accent-green); }
.stat-card .stat-change.negative { color: var(--accent-red); }

/* Color accented stat cards */
.stat-card.blue { border-left: 3px solid var(--accent-blue); }
.stat-card.green { border-left: 3px solid var(--accent-green); }
.stat-card.yellow { border-left: 3px solid var(--accent-yellow); }
.stat-card.red { border-left: 3px solid var(--accent-red); }
.stat-card.purple { border-left: 3px solid var(--accent-purple); }

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.data-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: var(--bg-surface-hover);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tr {
  transition: all var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.002);
  cursor: pointer;
}

/* Selected row */
.data-table tr.selected {
  background: var(--accent-blue-soft);
  border-left: 3px solid var(--accent-blue);
}

.data-table .cell-primary {
  font-weight: 600;
  color: var(--text-primary);
}

.data-table .cell-secondary {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: normal;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge.prospect { background: var(--accent-blue-soft); color: var(--accent-blue); }
.badge.contacted { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.badge.qualified { background: var(--accent-purple-soft); color: var(--accent-purple); }
.badge.proposal_sent { background: var(--accent-yellow-soft); color: var(--accent-yellow); }
.badge.negotiation { background: var(--accent-orange-soft); color: var(--accent-orange); }
.badge.won { background: var(--accent-green-soft); color: var(--accent-green); }
.badge.lost { background: var(--accent-red-soft); color: var(--accent-red); }

/* Score badge */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
}

.score-badge.high { background: var(--accent-green-soft); color: var(--accent-green); }
.score-badge.medium { background: var(--accent-yellow-soft); color: var(--accent-yellow); }
.score-badge.low { background: var(--accent-red-soft); color: var(--accent-red); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 6px;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}
.btn-primary:hover { background: var(--accent-blue-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border-color: transparent;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-md);
}

/* --- Inputs --- */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-soft);
  transform: scale(1.01);
}

.form-input::placeholder { color: var(--text-muted); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group {
  margin-bottom: 1rem;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent-blue-soft);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* --- Slide Panel (Lead Detail / Right Drawer) --- */
.slide-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.slide-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-default);
  z-index: 501;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.slide-panel.open {
  transform: translateX(0);
}

.slide-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.slide-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.slide-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.slide-panel-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-default);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* --- Detail Fields --- */
.detail-field {
  margin-bottom: 1.25rem;
}

.detail-field .field-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.detail-field .field-value {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
}

/* --- Activity Timeline --- */
.activity-timeline {
  position: relative;
  padding-left: 1.5rem;
}

.activity-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-default);
}

.activity-item {
  position: relative;
  padding: 0.5rem 0 1rem 0;
}

.activity-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.85rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-light);
  border: 2px solid var(--bg-secondary);
}

.activity-item.type-call::before { background: var(--accent-green); }
.activity-item.type-note::before { background: var(--accent-yellow); }
.activity-item.type-status::before { background: var(--accent-blue); }
.activity-item.type-email::before { background: var(--accent-purple); }

.activity-content {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.activity-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* --- Empty States --- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h4 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 360px;
  margin: 0 auto;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 1.25rem;
}

.tab {
  padding: 0.65rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* --- Search Box --- */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 2.25rem;
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Toasts / Notifications --- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Lead Intelligence Engine --- */
.li-console {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-primary));
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.li-console::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.li-console-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.li-engine-badge {
  color: var(--accent-blue);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.li-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

.li-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.li-area-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-normal);
}

.li-area-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.li-area-card.gold_zone {
  border-left: 3px solid var(--accent-yellow);
}

.li-area-card.high_yield {
  border-left: 3px solid var(--accent-green);
}

.li-area-badge {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.li-area-card h4 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.li-area-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.btn-outline:hover {
  background: var(--accent-blue-soft);
}

@media (max-width: 900px) {
  .li-form {
    grid-template-columns: 1fr;
  }
  .li-console-header {
    flex-direction: column;
    gap: 0.75rem;
  }
  .li-area-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .page-content {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .slide-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th, .data-table td {
    padding: 0.6rem 0.5rem;
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
  }

  .page-header {
    padding: 0 1rem;
  }

  .mobile-menu-btn {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .mobile-menu-btn {
    display: none !important;
  }
  .mobile-overlay {
    display: none !important;
  }
}

/* --- Attendance & Productivity UI --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active { background: var(--accent-green-soft); color: var(--accent-green); }
.status-badge.idle { background: var(--accent-yellow-soft); color: var(--accent-yellow); }
.status-badge.offline { background: var(--bg-surface-hover); color: var(--text-muted); }

.progress-bar-container {
    width: 100px;
    height: 6px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.stat-card .stat-value {
    font-family: 'Outfit', sans-serif;
}

/* --- Glass / Premium UI Layer --- */
.glass {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.05);
}

/* --- Micro Animations (SaaS feel) --- */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Lead Priority Highlight --- */
.lead-high {
  border-left: 4px solid var(--accent-green) !important;
}

.lead-medium {
  border-left: 4px solid var(--accent-yellow) !important;
}

.lead-low {
  border-left: 4px solid var(--accent-red) !important;
}

/* --- Sticky Action Bar --- */
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
  padding: 10px;
  border-top: 1px solid var(--border-default);
  z-index: 10;
}

/* --- Hover Glow --- */
.glow-hover:hover {
  box-shadow: var(--shadow-glow-blue);
}

/* --- Additional Utilities --- */
.text-center { text-align: center; }
.m-center { margin-left: auto; margin-right: auto; }
.d-block { display: block; }

/* --- Consultant AI Layer UI --- */
.consultant-hook {
    background: var(--accent-yellow-soft);
    color: var(--accent-yellow);
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-yellow);
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.consultant-card {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.consultant-card h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.consultant-card .content {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.consultant-hidden-loss {
    background: var(--accent-red-soft);
    color: var(--accent-red);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0.5rem;
    text-align: center;
    border: 1px dashed var(--accent-red);
}

.smart-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.smart-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.smart-btn:hover {
    background: var(--bg-surface-active);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.smart-btn i {
    font-size: 1.25rem;
}

.smart-btn.whatsapp i { color: #25D366; }
.smart-btn.call i { color: var(--accent-blue); }
.smart-btn.maps i { color: var(--accent-orange); }

.smart-btn span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.pitch-box {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-style: italic;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent-purple);
    position: relative;
}

.pitch-box::before {
    content: '"';
    position: absolute;
    top: -5px;
    left: 5px;
    font-size: 2rem;
    color: var(--accent-purple-soft);
    font-family: serif;
}

.audit-badge {
    background: var(--accent-cyan-soft);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
}

.copy-btn-abs {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
}

.copy-btn-abs:hover {
    opacity: 1;
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

