:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.brand-mark {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 0.9rem; }
.nav a:hover { color: var(--text); }
.nav-muted { opacity: 0.7; }

.main { padding: 1.5rem 1.25rem 3rem; }

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.hero h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.warn { color: var(--warn); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.stat-card.active { border-color: var(--accent); background: var(--surface2); }

.stat-num { display: block; font-size: 1.75rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.panel-head h2 { margin: 0; font-size: 1.1rem; }

.filters select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}

.lead-list { display: flex; flex-direction: column; gap: 0.75rem; }

.lead-row {
  display: block;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s;
}

.lead-row:hover { border-color: var(--accent); text-decoration: none; }

.lead-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--border);
}

.badge-reddit { background: #ff450033; color: #ff8a65; }
.badge-quora { background: #b92b2733; color: #ef9a9a; }
.badge-status { text-transform: none; letter-spacing: 0; }
.badge-pending_review { background: #f59e0b33; color: #fbbf24; }
.badge-approved { background: #22c55e33; color: #86efac; }
.badge-rejected { background: #ef444433; color: #fca5a5; }
.badge-posted { background: #3b82f633; color: #93c5fd; }
.badge-type { background: #8b5cf633; color: #c4b5fd; text-transform: none; }

.lead-title { margin: 0 0 0.35rem; font-size: 1rem; font-weight: 600; }
.lead-preview { margin: 0; color: var(--muted); font-size: 0.9rem; }
.lead-foot { margin-top: 0.5rem; }

.empty { color: var(--muted); text-align: center; padding: 2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }

.flash-stack { margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.flash-success { background: #22c55e22; border: 1px solid #22c55e55; color: #86efac; }
.flash-error { background: #ef444422; border: 1px solid #ef444455; color: #fca5a5; }

.scrape-log { margin-bottom: 1rem; }
.scrape-log pre {
  background: var(--bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.75rem;
  max-height: 240px;
}

.breadcrumb { margin-bottom: 1rem; }

.lead-detail-head { margin-bottom: 1.5rem; }
.lead-detail-head h1 { margin: 0.5rem 0; font-size: 1.35rem; line-height: 1.3; }
.lead-meta-line { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.source-link { margin: 0.75rem 0 0; }

.detail-block { margin-bottom: 1.5rem; }
.detail-block h2 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.content-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-box { border-color: #3b82f655; }
.empty-reply { color: var(--warn); font-style: italic; }

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.action-bar form { margin: 0; }

.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1a2332 0%, var(--bg) 60%);
}

.login-card {
  width: min(400px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.login-brand { margin-bottom: 0.25rem; }
.login-sub { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.9rem; }

.login-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-form input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 600px) {
  .nav { gap: 0.6rem; }
  .hero h1 { font-size: 1.4rem; }
}
