* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --secondary: #f97316;
  --dark: #1f2937;
  --gray: #6b7280;
  --light: #f3f4f6;
  --white: #fff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --border: #e5e7eb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--dark);
  background: var(--light);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth Pages */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 100%);
  padding: 20px;
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-card h1 {
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-card .subtitle {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-card .logo {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  display: block;
}

.auth-card .logo span { color: var(--primary); }

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .hint { font-size: 12px; color: var(--gray); margin-top: 4px; }

.btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--light);
  color: var(--dark);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: #e5e7eb; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }

.btn-sm { padding: 6px 14px; font-size: 13px; width: auto; }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--gray);
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--dark);
  color: var(--white);
  padding: 20px 0;
  flex-shrink: 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 20px 20px;
  font-size: 18px;
  font-weight: 800;
  border-bottom: 1px solid #374151;
  margin-bottom: 12px;
}

.sidebar-logo span { color: var(--primary); }

.sidebar nav a {
  display: block;
  padding: 12px 20px;
  color: #d1d5db;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #374151;
  color: var(--white);
}

.sidebar .user-info {
  padding: 16px 20px;
  border-top: 1px solid #374151;
  margin-top: 20px;
  font-size: 13px;
  color: #9ca3af;
}

.sidebar .user-info .email {
  color: var(--white);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 30px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
}

.stat-card .label {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

table th {
  background: var(--light);
  font-weight: 600;
  font-size: 13px;
  color: var(--gray);
  text-transform: uppercase;
}

table tr:hover { background: #f9fafb; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-draft { background: #e5e7eb; color: #4b5563; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-live { background: #dcfce7; color: #166534; }
.badge-archived { background: #f3f4f6; color: #6b7280; }
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-contacted { background: #fef3c7; color: #92400e; }
.badge-closed { background: #dcfce7; color: #166534; }

/* Actions */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Onboarding banner */
.onboarding-banner {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-banner .text {
  font-size: 14px;
  color: #92400e;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { font-size: 22px; margin-bottom: 16px; }

.modal-close {
  float: right;
  cursor: pointer;
  font-size: 24px;
  color: var(--gray);
  border: none;
  background: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--gray);
}

.loading { text-align: center; padding: 40px; color: var(--gray); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}