* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #2563eb;
  --brand-dark: #1e40af;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ============ NAV ============ */
.nav {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-brand {
  color: white;
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.nav-links { display: flex; gap: 16px; }
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* ============ LAYOUT ============ */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ============ STAT CARDS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
}

.stat-card .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--gray-900);
  margin-top: 4px;
}

.stat-card .sub {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ============ TIER BADGES ============ */
.tier { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.tier-A { background: #dcfce7; color: #166534; }
.tier-B { background: #dbeafe; color: #1e40af; }
.tier-C { background: #fef3c7; color: #92400e; }
.tier-D { background: #fee2e2; color: #991b1b; }

/* ============ STATUS BADGES ============ */
.status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-new { background: #dbeafe; color: #1e40af; }
.status-contacted { background: #fef3c7; color: #92400e; }
.status-converted { background: #dcfce7; color: #166534; }
.status-cold { background: var(--gray-100); color: var(--gray-500); }
.status-bounced { background: #fee2e2; color: #991b1b; }
.status-unsubscribed { background: var(--gray-200); color: var(--gray-700); }

/* ============ TABLE ============ */
.table-wrap {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
  overflow-x: auto;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.table-header h2 { font-size: 16px; font-weight: 700; }

.table-actions { display: flex; gap: 8px; align-items: center; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tr:hover td { background: var(--gray-50); }

/* ============ FORMS & BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; }

input, select, textarea {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 100px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal h3 { font-size: 18px; margin-bottom: 16px; }

/* ============ FILTERS ============ */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  transition: all 0.2s;
}

.filter-chip:hover, .filter-chip.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* ============ SCORE BAR ============ */
.score-bar {
  width: 60px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-400);
}

.empty-state h3 { font-size: 18px; color: var(--gray-500); margin-bottom: 8px; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav { padding: 12px 16px; }
  .table-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}
