/* ─── Source Genius Web App — Dark Theme ─────────────────────────────────── */
:root {
  --bg:          #0f0f13;
  --bg2:         #16161e;
  --bg3:         #1e1e2a;
  --bg4:         #252535;
  --border:      #2a2a3a;
  --border2:     #333348;
  --accent:      #7c6af7;
  --accent-hover:#9585ff;
  --accent-dim:  rgba(124,106,247,0.15);
  --green:       #2ecc71;
  --green-dim:   rgba(46,204,113,0.15);
  --red:         #e74c3c;
  --red-dim:     rgba(231,76,60,0.15);
  --yellow:      #f1c40f;
  --yellow-dim:  rgba(241,196,15,0.15);
  --blue:        #3498db;
  --blue-dim:    rgba(52,152,219,0.15);
  --orange:      #e67e22;
  --text:        #e2e2f0;
  --text2:       #9898b8;
  --text3:       #5a5a78;
  --radius:      8px;
  --radius2:     12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --transition:  0.18s ease;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

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

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
a  { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo span.logo-icon {
  font-size: 1.4rem;
}
.sidebar-logo span.logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.sidebar-logo span.logo-version {
  font-size: 0.7rem;
  color: var(--text3);
  margin-left: auto;
  background: var(--bg4);
  padding: 2px 6px;
  border-radius: 10px;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.nav-section {
  padding: 6px 16px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text2);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  font-size: 0.88rem;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
  border-left-color: var(--border2);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1rem; width: 18px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sidebar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-plan {
  color: var(--text3);
  font-size: 0.72rem;
}
.btn-logout {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 7px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
  text-align: center;
}
.btn-logout:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }

/* ─── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.topbar-subtitle { font-size: 0.78rem; color: var(--text3); }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.page-body {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h3 { font-size: 0.95rem; }
.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text3);
}

/* ─── Stats Grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  font-weight: 600;
}
.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-card .stat-sub {
  font-size: 0.75rem;
  color: var(--text3);
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg3);
  color: var(--text2);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg4); color: var(--text); }
.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
}
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red);
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }
.btn-icon { padding: 7px; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text2);
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ─── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
thead tr {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
.td-email { font-family: monospace; font-size: 0.82rem; color: var(--text2); }

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-valid   { background: var(--green-dim);  color: var(--green); }
.badge-invalid { background: var(--red-dim);    color: var(--red); }
.badge-risky   { background: var(--yellow-dim); color: var(--yellow); }
.badge-unknown { background: var(--bg4);        color: var(--text3); }
.badge-catch-all { background: var(--blue-dim); color: var(--blue); }
.badge-queued  { background: var(--bg4);        color: var(--text3); }
.badge-running { background: var(--blue-dim);   color: var(--blue); }
.badge-done    { background: var(--green-dim);  color: var(--green); }
.badge-failed  { background: var(--red-dim);    color: var(--red); }
.badge-active  { background: var(--green-dim);  color: var(--green); }
.badge-suspended { background: var(--yellow-dim); color: var(--yellow); }
.badge-blocked { background: var(--red-dim);    color: var(--red); }
.badge-admin   { background: var(--accent-dim); color: var(--accent); }
.badge-free    { background: var(--bg4);        color: var(--text3); }

/* ─── Progress ─────────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--bg3);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.3s ease;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 4px;
}

/* ─── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error   { background: var(--red-dim);    border: 1px solid var(--red);    color: var(--red); }
.alert-success { background: var(--green-dim);  border: 1px solid var(--green);  color: var(--green); }
.alert-info    { background: var(--blue-dim);   border: 1px solid var(--blue);   color: var(--blue); }
.alert-warn    { background: var(--yellow-dim); border: 1px solid var(--yellow); color: var(--yellow); }

/* ─── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body   { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius);
}
.btn-close:hover { background: var(--bg3); color: var(--text); }

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 18px;
}
.tab-btn {
  flex: 1;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all var(--transition);
  text-align: center;
}
.tab-btn:hover { background: var(--bg4); color: var(--text2); }
.tab-btn.active {
  background: var(--bg2);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── Drop Zone ────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius2);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 10px; }
.drop-zone-label { font-size: 0.95rem; color: var(--text2); margin-bottom: 6px; }
.drop-zone-sub { font-size: 0.78rem; color: var(--text3); }
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ─── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ─── Loading spinner ──────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Login page ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  width: 100%;
  max-width: 400px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.auth-logo .logo-name { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.auth-logo .logo-sub  { font-size: 0.8rem; color: var(--text3); margin-top: 2px; }
.auth-tabs { margin-bottom: 22px; }
.auth-error {
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  margin-bottom: 14px;
}
.auth-success {
  background: var(--green-dim);
  border: 1px solid var(--green);
  color: var(--green);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  margin-bottom: 14px;
}

/* ─── Announcement Banner ──────────────────────────────────────────────────── */
.announcement-bar {
  background: linear-gradient(90deg, var(--accent-dim), var(--bg3));
  border-bottom: 1px solid var(--accent);
  padding: 8px 24px;
  font-size: 0.82rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.announcement-bar.hidden { display: none; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger {
    display: block !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

/* ─── Misc Utilities ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.monospace { font-family: monospace; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
