* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
}

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: #1e293b;
  padding: 40px;
  border-radius: 12px;
  width: 360px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.login-box h1 {
  margin: 0 0 8px;
  color: #f8fafc;
}

.login-box p {
  margin: 0 0 24px;
  color: #94a3b8;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #3b82f6;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}

.login-box button:hover { background: #2563eb; }

.error { color: #ef4444; margin-top: 12px; min-height: 20px; }

/* Nav */
nav {
  background: #1e293b;
  padding: 14px 24px;
  display: flex;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid #334155;
}

nav a {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
}

nav a:hover, nav a.active {
  color: #f8fafc;
  background: #334155;
}

.nav-btn {
  margin-left: auto;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.nav-btn:hover { background: #334155; color: #f8fafc; }

/* Main */
main {
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

h1 { color: #f8fafc; margin-top: 0; }
h2 { color: #f8fafc; margin-top: 32px; }

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

.stat-card {
  background: #1e293b;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid #334155;
}

.stat-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.stat-card p {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: #f8fafc;
}

/* Form */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.form-row input, .form-row select {
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  font-size: 14px;
}

.form-row button, .refresh {
  padding: 10px 16px;
  background: #3b82f6;
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.form-row button:hover, .refresh:hover { background: #2563eb; }

.msg { color: #10b981; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 16px;
}

th {
  background: #0f172a;
  text-align: left;
  padding: 12px 14px;
  font-size: 12px;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #334155;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid #334155;
  font-size: 14px;
  color: #e2e8f0;
}

tr:last-child td { border-bottom: 0; }

td a { color: #60a5fa; }

td button {
  padding: 4px 10px;
  background: #334155;
  color: #e2e8f0;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-right: 4px;
}

td button:hover { background: #475569; }

/* Status pills */
.status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  background: #334155;
  color: #e2e8f0;
}

.status-pending { background: #475569; }
.status-scraping, .status-checking, .status-writing, .status-sending { background: #1d4ed8; color: #fff; }
.status-done, .status-sent { background: #059669; color: #fff; }
.status-paused, .status-bounced, .status-failed { background: #dc2626; color: #fff; }
.status-skipped { background: #6b7280; color: #fff; }
.status-scraped { background: #6366f1; color: #fff; }
.status-website_checked { background: #8b5cf6; color: #fff; }
.status-email_ready { background: #f59e0b; color: #fff; }
.status-replied { background: #10b981; color: #fff; }

/* Dialog */
dialog {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 24px;
  max-width: 600px;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

dialog pre {
  white-space: pre-wrap;
  background: #0f172a;
  padding: 16px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}
