* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  --status-lead-bg: #fef9c3;
  --status-lead-text: #854d0e;
  --status-active-bg: #dcfce7;
  --status-active-text: #166534;
  --status-closed-bg: #e0f2fe;
  --status-closed-text: #075985;
  --status-inactive-bg: #f1f5f9;
  --status-inactive-text: #475569;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', -apple-system, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--border-light);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

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

.stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.075em;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
  letter-spacing: -0.025em;
}

.search-bar {
  margin-bottom: 16px;
}

#searchInput {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#searchInput::placeholder {
  color: var(--text-secondary);
}

/* Kanban View Styles */

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  background: white;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: 8px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.close {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
  line-height: 1;
  padding: 4px;
}

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

.close.hidden {
  display: none;
}

#contactForm {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.form-actions .btn-danger {
  margin-right: auto;
}

.error-message {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Confirmation Modal */
.modal-confirm-content {
  max-width: 400px;
  text-align: center;
  padding: 32px;
  animation: scaleIn 0.2s ease;
}

.confirm-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

#confirmTitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.025em;
}

#confirmMessage {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-actions .btn {
  min-width: 120px;
}

/* Kanban View Styles */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: 400px;
  overflow-x: auto;
}

.kanban-column {
  background: var(--border-light);
  border-radius: 8px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-column-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kanban-column-count {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
}

.kanban-column.lead .kanban-column-header {
  border-top: 3px solid var(--status-lead-text);
}

.kanban-column.active .kanban-column-header {
  border-top: 3px solid var(--status-active-text);
}

.kanban-column.closed .kanban-column-header {
  border-top: 3px solid var(--status-closed-text);
}

.kanban-column.inactive .kanban-column-header {
  border-top: 3px solid var(--status-inactive-text);
}

.kanban-column-content {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100px;
}

.kanban-column-content.drag-over {
  background: rgba(37, 99, 235, 0.05);
  border-radius: 0 0 8px 8px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  padding-top: 16px;
  cursor: grab;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  position: relative;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.3;
  transform: scale(0.95);
}

.kanban-card-ghost {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  transition: transform 0.1s ease;
}

.kanban-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.kanban-card-email {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kanban-card-company {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Animation for when cards are moved */
@keyframes cardDrop {
  0% {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--shadow);
  }
}

.kanban-card.dropped {
  animation: cardDrop 0.3s ease;
}

/* Empty column state */
.kanban-column-content:empty::before {
  content: 'Drop cards here';
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: center;
  padding: 20px;
  font-style: italic;
  opacity: 0.5;
}

/* Kanban Edit Button */
.kanban-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
  font-size: 0.875rem;
  z-index: 10;
  pointer-events: none;
}

.kanban-card:hover .kanban-edit-btn {
  opacity: 1;
  pointer-events: auto;
}

.kanban-edit-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.1);
}

/* Responsive Kanban */
@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
    overflow-y: auto;
  }
  
  .kanban-column {
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  .kanban-board {
    grid-template-columns: 1fr;
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  .kanban-column {
    min-height: 200px;
  }
  
  .kanban-column-content {
    min-height: 50px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  header {
    flex-direction: column;
    gap: 16px;
    padding: 24px 0;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .modal-content {
    width: 95%;
    max-height: 85vh;
  }

  .modal-header,
  #contactForm {
    padding: 20px;
  }
}