/* Pursuo App — Dark theme matching landing page */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a26;
  --surface-3: #222233;
  --accent: #e8ff47;
  --accent-dim: rgba(232, 255, 71, 0.08);
  --accent-hover: rgba(232, 255, 71, 0.15);
  --text: #f0f0f5;
  --text-dim: #8888a0;
  --text-muted: #55556a;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 240px;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== AUTH SCREENS ===== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.auth-logo span { color: var(--accent); }

.auth-subtitle {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 36px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent);
}

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

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover {
  background: #d4eb3c;
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

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

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-switch {
  text-align: center;
  margin-top: 24px;
  color: var(--text-dim);
  font-size: 14px;
}

.auth-switch a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

/* ===== APP LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.5px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  max-width: 1200px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.stat-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
}

.stat-card-value.accent { color: var(--accent); }
.stat-card-value.success { color: var(--success); }
.stat-card-value.warning { color: var(--warning); }

/* ===== DATA TABLE ===== */
.data-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.data-table-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.data-table td {
  padding: 14px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

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

.data-table tr:hover td {
  background: var(--surface-2);
}

.data-table td.primary {
  color: var(--text);
  font-weight: 500;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-new { background: rgba(96, 165, 250, 0.1); color: var(--info); }
.status-new::before { background: var(--info); }
.status-contacted { background: var(--accent-dim); color: var(--accent); }
.status-contacted::before { background: var(--accent); }
.status-replied { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.status-replied::before { background: var(--success); }
.status-meeting_booked { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.status-meeting_booked::before { background: var(--success); }
.status-won { background: rgba(74, 222, 128, 0.2); color: #22c55e; }
.status-won::before { background: #22c55e; }
.status-lost { background: rgba(248, 113, 113, 0.1); color: var(--danger); }
.status-lost::before { background: var(--danger); }
.status-cold { background: rgba(136, 136, 160, 0.1); color: var(--text-dim); }
.status-cold::before { background: var(--text-dim); }
.status-pending { background: rgba(251, 191, 36, 0.1); color: var(--warning); }
.status-pending::before { background: var(--warning); }
.status-sent, .status-ready { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.status-sent::before, .status-ready::before { background: var(--success); }
.status-failed { background: rgba(248, 113, 113, 0.1); color: var(--danger); }
.status-failed::before { background: var(--danger); }
.status-cancelled { background: rgba(136, 136, 160, 0.1); color: var(--text-muted); }
.status-cancelled::before { background: var(--text-muted); }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===== DROPZONE ===== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover, .dropzone.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.dropzone-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.dropzone-text {
  color: var(--text-dim);
  font-size: 14px;
}

.dropzone-text strong {
  color: var(--accent);
}

/* ===== TIMELINE / SEQUENCE EDITOR ===== */
.sequence-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sequence-step {
  display: grid;
  grid-template-columns: 60px 1fr 80px auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sequence-step-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.step-delay-input {
  width: 70px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 24px;
}

/* ===== EMAIL PREVIEW ===== */
.email-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}

.email-preview-subject {
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.email-preview-body {
  font-size: 14px;
  color: var(--text-dim);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* ===== TOASTS ===== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
}

.toast-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== LOADING ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 12px;
  color: var(--text-dim);
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-chip {
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent-dim);
  border-color: rgba(232, 255, 71, 0.2);
  color: var(--accent);
}

/* ===== SEARCH BAR ===== */
.search-input {
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 240px;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ===== PIPELINE VIEW ===== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.pipeline-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 100px;
}

.pipeline-col-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipeline-col-count {
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
}

.pipeline-card {
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.pipeline-card:hover {
  border-color: var(--border-hover);
}

.pipeline-card-name {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 2px;
}

.pipeline-card-company {
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

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

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .page-header h1 {
    font-size: 22px;
  }

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

  .pipeline-grid {
    grid-template-columns: 1fr;
  }

  .sequence-step {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .data-table-wrapper {
    overflow-x: auto;
  }

  .mobile-menu-btn {
    display: flex !important;
  }
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
