:root {
  /* Color Palette - Deep Obsidian & Electric Violet */
  --bg-deep: #0a0a0c;
  --bg-surface: #141417;
  --bg-card: #1c1c21;
  --accent-primary: #8b5cf6;
  --accent-secondary: #d946ef;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --border-color: #27272a;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  --space-2xl: 64px;
  
  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

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

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  min-height: 100vh;
}

/* Sidebar Layout */
.sidebar {
  width: 280px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: var(--space-lg);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.nav-item {
  margin-bottom: var(--space-xs);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  text-decoration: none;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-weight: 500;
}

.nav-link:hover, .nav-link.active {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.nav-link.active {
  border-left: 4px solid var(--accent-primary);
}

/* Main Content Area */
main {
  flex-grow: 1;
  padding: var(--space-xl);
  max-width: calc(100vw - 280px);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.page-title h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.page-title p {
  margin: var(--space-xs) 0 0 0;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

/* UI Components */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-card);
}

.search-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-main);
  width: 300px;
  outline: none;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-trend {
  font-size: 0.75rem;
  margin-top: var(--space-sm);
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* Main Visuals */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.card-body {
  padding: var(--space-lg);
}

/* Tables & Mobile Grid */
.table-container {
  width: 100%;
  overflow-x: auto;
}

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

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.mobile-data-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.mobile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.mobile-card-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-card-row:last-child {
  border-bottom: none;
}

.mobile-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.mobile-value {
  font-size: 0.9rem;
  font-weight: 500;
}

.customer-cell {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.placeholder-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-info { background: rgba(139, 92, 246, 0.1); color: var(--accent-primary); }

/* Activity Feed */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.activity-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-content p {
  margin: 0;
  font-size: 0.9rem;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

/* Placeholder for visuals */
.chart-placeholder {
  height: 250px;
  width: 100%;
  background: linear-gradient(0deg, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0) 100%);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 20px;
}

.chart-bar {
  flex: 1;
  background: var(--accent-primary);
  border-radius: 4px 4px 0 0;
  opacity: 0.6;
  transition: var(--transition);
}

.chart-bar:hover {
  opacity: 1;
}

.user-profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.user-profile .placeholder-avatar {
  width: 40px;
  height: 40px;
  font-weight: bold;
  background: var(--accent-primary);
  color: white;
}

.user-info-name {
  font-weight: 600;
  font-size: 0.9rem;
}

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

.card-action-btn {
  font-size: 0.8rem !important;
  padding: 4px 12px !important;
}

.customer-info-name {
  font-weight: 500;
}

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

.table-action-btn {
  border: none;
  cursor: pointer;
  background: none;
  color: var(--text-muted);
  transition: var(--transition);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-action-btn:hover {
  color: var(--text-main);
}

.pipeline-chart-container {
  margin-top: 24px;
}

.pipeline-title {
  font-size: 1rem;
  margin-bottom: 12px;
}

.ai-insight-box {
  margin-top: 32px;
  padding: 16px;
  background: rgba(139, 92, 246, 0.05);
  border-radius: 12px;
  border: 1px dashed var(--accent-primary);
}

.ai-insight-title {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
}

.ai-insight-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ai-insight-btn {
  margin-top: 12px;
  width: 100%;
  font-size: 0.8rem !important;
  justify-content: center;
}

/* Responsiveness */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  main {
    max-width: 100vw;
    padding: var(--space-md);
  }
  .header-actions {
    flex-direction: row;
    width: 100%;
  }
  .search-bar {
    flex-grow: 1;
    width: auto;
  }

  /* Switch Table to Grid on Mobile */
  .table-container {
    display: none;
  }
  .mobile-data-grid {
    display: grid;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
