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

body {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: #111;
  background: #fff;
}

a { color: #0070f3; }

/* ── Landing ─────────────────────────────────────────────────── */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid #e9ecef;
}
.nav-logo { font-weight: 700; font-size: 1.2rem; color: #111; text-decoration: none; }
.nav-actions { display: flex; gap: 0.75rem; align-items: center; }

header.hero {
  padding: 5rem 2rem 4rem;
  text-align: center;
  background: linear-gradient(135deg, #f0f7ff 0%, #fff 60%);
  border-bottom: 1px solid #e9ecef;
}
header.hero h1 { font-size: 2.8rem; line-height: 1.2; margin-bottom: 1rem; }
header.hero h1 span { color: #0070f3; }
header.hero p.lead { font-size: 1.15rem; color: #555; max-width: 540px; margin: 0 auto 2rem; }

.register-box {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}
.register-box input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: 0.75rem 1rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 1rem;
}
.register-box input[type="email"]:focus {
  outline: 2px solid #0070f3;
  border-color: transparent;
}

main.landing { max-width: 1000px; margin: 0 auto; padding: 2rem; }

.features { margin: 3rem 0; }
.section-title { font-size: 1.6rem; text-align: center; margin-bottom: 0.5rem; }
.section-sub { text-align: center; color: #666; margin-bottom: 2rem; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  padding: 1.5rem;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  background: #fafafa;
}
.feature-card .icon { font-size: 1.8rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.feature-card p { font-size: 0.9rem; color: #555; margin: 0; }

.pricing { margin: 3rem 0; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 640px;
  margin: 0 auto;
}
.pricing-card {
  padding: 2rem;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  text-align: center;
}
.pricing-card.featured {
  border: 2px solid #0070f3;
  position: relative;
}
.pricing-card .badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #0070f3;
  color: #fff;
  font-size: 0.75rem;
  padding: 0.2rem 0.75rem;
  border-radius: 99px;
  font-weight: 600;
}
.pricing-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.price { font-size: 2.5rem; font-weight: 700; margin: 0.5rem 0 1rem; }
.price span { font-size: 1rem; font-weight: 400; color: #666; }
.pricing-card ul { list-style: none; text-align: left; margin: 1rem 0; padding: 0; }
.pricing-card ul li { padding: 0.3rem 0; font-size: 0.9rem; color: #444; }
.pricing-card ul li::before { content: "✓ "; color: #0070f3; font-weight: 700; }

/* ── Shared buttons ──────────────────────────────────────────── */

button, .btn {
  display: inline-block;
  padding: 0.72rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  background: #0070f3;
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: #0051cc; }
button.secondary, .btn.secondary {
  background: #f4f4f4;
  color: #111;
  border: 1px solid #d0d0d0;
}
button.secondary:hover, .btn.secondary:hover { background: #e8e8e8; }
button.danger { background: #e53e3e; }
button.danger:hover { background: #c53030; }
button.small { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* ── Modal ───────────────────────────────────────────────────── */

.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.modal label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; margin-top: 0.75rem; }
.modal input, .modal textarea, .modal select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}
.modal input:focus, .modal textarea:focus, .modal select:focus {
  outline: 2px solid #0070f3;
  border-color: transparent;
}
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; justify-content: flex-end; }

/* ── Dashboard ───────────────────────────────────────────────── */

.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  padding: 0 0.5rem 1rem;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 0.5rem;
}
.sidebar a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.1s, color 0.1s;
}
.sidebar a:hover, .sidebar a.active { background: #1e293b; color: #fff; }
.sidebar-spacer { flex: 1; }
.sidebar-user { font-size: 0.8rem; color: #64748b; padding: 0.5rem; word-break: break-all; }

.dash-content { padding: 2rem; background: #f8fafc; overflow-y: auto; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.dash-header h1 { font-size: 1.4rem; }

.card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: #111; }

.banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.banner p { margin: 0; font-size: 0.9rem; color: #1e40af; }

.topic-list { display: flex; flex-direction: column; gap: 0.75rem; }
.topic-item {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.topic-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  user-select: none;
}
.topic-header:hover { background: #f8fafc; }
.topic-name { font-weight: 600; flex: 1; }
.topic-query { font-size: 0.8rem; color: #666; }
.topic-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.topic-badge.inactive { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.topic-actions { display: flex; gap: 0.4rem; }
.topic-body { padding: 0 1rem 1rem; border-top: 1px solid #f1f5f9; display: none; }
.topic-body.open { display: block; }

.match-list { list-style: none; padding: 0; margin-top: 0.75rem; }
.match-item { padding: 0.65rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; }
.match-item:last-child { border-bottom: none; }
.match-title { font-weight: 600; color: #0070f3; text-decoration: none; }
.match-title:hover { text-decoration: underline; }
.match-meta { color: #888; font-size: 0.78rem; margin: 0.15rem 0; }
.match-abstract { color: #444; line-height: 1.5; margin-top: 0.2rem; }

.cadence-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.cadence-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.cadence-option input { cursor: pointer; }
.cadence-option.disabled { opacity: 0.4; cursor: not-allowed; }

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-pill.free { background: #f4f4f4; color: #555; }
.status-pill.pro { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.empty-state { text-align: center; padding: 2rem; color: #888; font-size: 0.9rem; }

/* ── Simple pages ───────────────────────────────────────────── */

.simple-page {
  max-width: 540px;
  margin: 6rem auto;
  padding: 2rem;
  text-align: center;
}
.simple-page .icon-big { font-size: 3rem; margin-bottom: 1rem; }
.simple-page h1 { font-size: 1.8rem; margin-bottom: 0.75rem; }
.simple-page p { color: #555; margin-bottom: 1.5rem; }

/* ── Sources section ─────────────────────────────────────────── */

.sources-section { margin: 3rem 0; }
.sources-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}
.source-badge-card {
  padding: 0.5rem 1.25rem;
  border: 1px solid #e9ecef;
  border-radius: 99px;
  font-size: 0.9rem;
  color: #333;
  background: #f8fafc;
  font-weight: 500;
}

.pricing-single { display: flex; justify-content: center; }
.pricing-single .pricing-card { max-width: 420px; width: 100%; }

/* Source checkboxes in topic modal */
.source-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.35rem;
}
.source-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.source-check input { cursor: pointer; }

/* Topic sources line */
.topic-sources { font-size: 0.75rem; color: #888; }

@media (max-width: 640px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  header.hero h1 { font-size: 2rem; }
}
