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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1114;
  color: #e1e4e8;
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #161920;
  border-bottom: 1px solid #2d333b;
  padding: 16px 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

h1 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #f0f3f6;
}

.rated-count {
  font-size: 0.8rem;
  color: #8b949e;
  margin-right: 8px;
}

#refresh-btn {
  background: #238636;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

#refresh-btn:hover { background: #2ea043; }
#refresh-btn:disabled { background: #2d333b; cursor: wait; }

.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#search {
  flex: 1;
  background: #0d1117;
  border: 1px solid #2d333b;
  color: #e1e4e8;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}

#search:focus { border-color: #388bfd; }
#search::placeholder { color: #6e7681; }

select {
  background: #0d1117;
  border: 1px solid #2d333b;
  color: #e1e4e8;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.subreddit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sub-tag {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #2d333b;
  background: #0d1117;
  color: #8b949e;
  transition: all 0.15s;
}

.sub-tag.active {
  background: #1f2a3d;
  border-color: #388bfd;
  color: #58a6ff;
}

.sub-tag.source-reddit.active { background: #1f2a3d; border-color: #58a6ff; color: #58a6ff; }
.sub-tag.source-hn.active { background: #3d2a1a; border-color: #ff6600; color: #ff6600; }
.sub-tag.source-devto.active { background: #1a2d3d; border-color: #3b49df; color: #8b9cf7; }

/* Status */
.status {
  text-align: center;
  padding: 20px;
  color: #8b949e;
  font-size: 0.9rem;
}

/* Leads grid */
.leads-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: #21262d;
  max-width: 900px;
  margin: 0 auto;
}

.lead-card {
  background: #161920;
  padding: 16px 20px;
  transition: background 0.12s;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lead-card:hover { background: #1c2028; }
.lead-card.dismissed { opacity: 0.4; }

.lead-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  display: block;
}

.lead-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 2px;
}

.rate-btn {
  background: none;
  border: 1px solid #2d333b;
  border-radius: 6px;
  color: #6e7681;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.rate-btn:hover { border-color: #8b949e; color: #e1e4e8; }
.rate-btn.like.active { border-color: #238636; color: #3fb950; background: #1a3d2a; }
.rate-btn.dislike.active { border-color: #da3633; color: #f85149; background: #3d1a1a; }

.lead-score {
  background: #1a2d1a;
  color: #3fb950;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.7rem;
}

.lead-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: #8b949e;
}

.lead-source {
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.lead-source.source-reddit { background: #1f2a3d; color: #58a6ff; }
.lead-source.source-hn { background: #3d2a1a; color: #ff6600; }
.lead-source.source-devto { background: #1a2d3d; color: #8b9cf7; }

.lead-flair {
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.7rem;
}

.lead-flair.hiring {
  background: #1a3d2a;
  color: #3fb950;
}

.lead-flair.forhire {
  background: #3d2a1a;
  color: #d29922;
}

.lead-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #f0f3f6;
  margin-bottom: 6px;
  line-height: 1.4;
}

.lead-body {
  font-size: 0.82rem;
  color: #8b949e;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-budget {
  display: inline-block;
  margin-top: 8px;
  background: #2a1f3d;
  color: #bc8cff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Responsive */
@media (min-width: 700px) {
  header { padding: 16px 24px; }
  .leads-grid { margin: 16px auto; border-radius: 8px; overflow: hidden; border: 1px solid #21262d; }
}

@media (max-width: 500px) {
  .controls { flex-wrap: wrap; }
  select { flex: 1; min-width: 0; }
}

/* Loading spinner */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #2d333b;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }
