/* LeadRadar — a working surface, not a landing page. Everything here is tuned for
   reading a long list of leads quickly: high text contrast, one accent colour that only
   ever means "act on this", and no decoration that competes with the content. */

:root {
  --bg: #0a100e;
  --panel: #111b18;
  --panel-2: #16221e;
  --raised: #1b2a25;
  --line: #24352f;
  --line-soft: #1a2723;
  --text: #f1f8f5;
  --muted: #9cb0aa;          /* 6.9:1 on --panel */
  --dim: #7b908a;
  --green: #4ade9b;
  --green-ink: #052015;
  --green-line: #2b7a57;
  --amber: #fcc95f;
  --red: #ff8b8b;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; }

/* ── Header ─────────────────────────────────────────────────────────────────── */

/* Opaque rather than blurred: the niche strip has to stay legible while a long feed
   scrolls under it, and against this background a blur was doing nothing a solid fill
   does not. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 clamp(18px, 4vw, 40px);
  height: 62px;
}

.brand { font-weight: 800; letter-spacing: -.03em; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--green); color: var(--green-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 900;
}

.mainnav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.mainnav a {
  color: var(--muted);
  font-size: 14.5px;
  padding: 7px 12px;
  border-radius: 9px;
}
.mainnav a:hover { color: var(--text); background: var(--panel-2); }
.mainnav a.here { color: var(--text); background: var(--raised); font-weight: 600; }

.health { display: flex; gap: 6px; }
.health span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
}
.health span.on { color: var(--green); border-color: var(--green-line); }

/* The niche switcher. Present on every page, because a niche should be one click away
   from wherever the work is — not only from the profiles page. */
.nichebar {
  display: flex;
  gap: 7px;
  align-items: center;
  overflow-x: auto;
  padding: 0 clamp(18px, 4vw, 40px) 11px;
  scrollbar-width: none;
}
.nichebar::-webkit-scrollbar { display: none; }

.niche {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13.5px;
  color: var(--muted);
}
.niche:hover { color: var(--text); border-color: #38514a; }
.niche b { font-weight: 700; color: var(--text); font-size: 12.5px; }
.niche.here { background: var(--text); color: #08120f; border-color: var(--text); font-weight: 600; }
.niche.here b { color: #08120f; }
.niche.paused { opacity: .55; }
.niche.paused::before { content: "⏸"; font-size: 10px; }
.niche.add { border-style: dashed; color: var(--green); border-color: var(--green-line); }

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.shell { width: min(1180px, 92vw); margin: 0 auto; padding: 34px 0 90px; }

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(27px, 3.4vw, 36px); margin: 0; }
.eyebrow {
  color: var(--green);
  font-size: 11.5px;
  letter-spacing: .16em;
  font-weight: 800;
  margin: 0 0 9px;
  text-transform: uppercase;
}
.subhead { color: var(--muted); font-size: 15px; margin: 8px 0 0; max-width: 70ch; }

/* The dashboard's title and its scan button share one line: the feed is the page, and
   the heading should not push it below the fold. */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.hero h1 { font-size: clamp(27px, 3.4vw, 36px); margin: 0; }
.hero form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hero form select { flex: 1 1 190px; }

/* ── Controls ───────────────────────────────────────────────────────────────── */

.primary {
  background: var(--green);
  color: var(--green-ink);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.primary:hover { background: #6df0b3; }

.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  cursor: pointer;
}
.secondary:hover { border-color: #3d574f; background: var(--panel-2); }

select, input, textarea {
  background: #0c1614;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
}
select { width: auto; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--green); outline-offset: 2px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13.5px; }
label small { color: var(--dim); font-weight: 400; }
summary { cursor: pointer; color: var(--green); font-size: 14px; }
summary:hover { color: #6df0b3; }

/* ── Stats ──────────────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stats article {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  padding: 16px 18px;
  border-radius: var(--radius);
}
.stats span { color: var(--muted); display: block; font-size: 12.5px; margin-bottom: 6px; }
.stats strong { font-size: 27px; letter-spacing: -.03em; }

/* ── Filters ────────────────────────────────────────────────────────────────── */

/* Three filters people reach for daily sit in the open; the other six live behind a
   disclosure, so the panel stops being a wall of dropdowns. */
.quickbar {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 14px;
}
.quickbar label { flex: 1 1 180px; min-width: 150px; }
.quickbar select, .quickbar input { width: 100%; }
.quickbar .go { display: flex; gap: 8px; align-items: center; }

.more-filters { margin: 0 0 18px; }
.more-filters > summary { padding: 4px 2px; }
.filter-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  margin-top: 10px;
}
.filter-panel select, .filter-panel input { width: 100%; }
.filter-panel > div { align-self: end; display: flex; gap: 10px; align-items: center; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.filters { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: #38514a; }
.chip.active { background: var(--text); color: #08120f; border-color: var(--text); font-weight: 600; }
.last-run { color: var(--dim); font-size: 12.5px; }

.utility { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: 0 0 20px; }
.utility small { color: var(--dim); }

/* ── Lead cards ─────────────────────────────────────────────────────────────── */

.lead-list { display: grid; gap: 12px; }

.lead-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.lead-card:hover { border-color: var(--line); }
.lead-card.qualified { border-color: #2a5c47; }

.score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--green);
}
.score strong { font-size: 24px; letter-spacing: -.04em; }
.score span { color: var(--dim); font-size: 11px; }

.lead-main { padding: 18px 20px; min-width: 0; }

.lead-meta {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--dim);
  font-size: 12px;
}
.lead-meta .source { color: var(--text); font-weight: 700; }
.tier { border-radius: 999px; padding: 2px 9px; font-weight: 800; font-size: 11px; letter-spacing: .04em; }
.tier.HOT { background: var(--green); color: var(--green-ink); }
.tier.WARM { background: #3a2f12; color: var(--amber); }
.tier.REJECTED { background: var(--raised); color: var(--dim); }

.lead-card h2 { font-size: 18px; margin: 10px 0 7px; }
.lead-card h2 a:hover { color: var(--green); }
.excerpt { color: #c2d4ce; margin: 0 0 14px; font-size: 14.5px; }

.signal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.signal-grid div { background: var(--panel-2); padding: 9px 11px; border-radius: var(--radius-sm); min-width: 0; }
.signal-grid span { color: var(--dim); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.signal-grid strong { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rationale { color: var(--amber); font-size: 13px; margin: 12px 0 0; line-height: 1.5; }
.rationale[role="alert"] { color: var(--red); }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
}
.open-link { color: var(--green); font-size: 13.5px; font-weight: 600; }
.open-link:hover { color: #6df0b3; }

/* ── Cards, profiles, tables ────────────────────────────────────────────────── */

.profile-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 22px; align-items: start; }
.existing-profiles { display: grid; gap: 14px; }
.profile-card, .profile-form {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
}
.profile-card h2, .profile-form h2 { margin: 0 0 10px; font-size: 19px; }
.profile-card p { color: var(--muted); }
.profile-card > p:first-of-type { margin-top: 0; }

.card-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.state { font-size: 12.5px; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.state.on { color: var(--green); background: #10301f; }
.state.off { color: var(--dim); background: var(--raised); }

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 13px 0; }
.tag-row span { background: var(--raised); color: #bfd6ce; border-radius: 7px; padding: 4px 9px; font-size: 12px; }

.profile-form { display: grid; gap: 13px; position: sticky; top: 118px; }
.stack { display: grid; gap: 13px; margin: 16px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Ticking a niche beats typing its English name into a comma-separated field. */
.niche-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0c1614;
}
.niche-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  padding: 3px 2px;
}
.niche-picker input { width: auto; margin: 0; accent-color: var(--green); }

/* A table with a column per outcome outgrows a phone, and a squeezed cell is unreadable.
   Let it scroll sideways rather than wrap every heading onto three lines. */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 560px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 9px 6px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
tr:last-child td { border-bottom: 0; }

code { background: var(--raised); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; word-break: break-all; }

.empty {
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 62px 20px;
  color: var(--muted);
}
.empty h2 { color: var(--text); margin: 0 0 8px; }

[role="status"], [role="alert"] {
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  margin: 0 0 16px;
  font-size: 14.5px;
}
[role="status"] { background: #10301f; color: var(--green); }
[role="alert"] { background: #341a1a; color: var(--red); }

/* ── Small screens ──────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-form { position: static; }
  .filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  body { font-size: 15.5px; }
  .topbar-row { height: auto; padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .mainnav { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { padding: 6px 10px; font-size: 14px; }
  .health { margin-left: auto; }
  .nichebar { padding: 0 16px 10px; }
  .shell { width: min(94vw, 680px); padding-top: 24px; }
  .hero, .hero form { width: 100%; }
  .hero form select, .hero form .primary { flex: 1 1 100%; width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filter-panel { grid-template-columns: 1fr; }
  .quickbar label { flex: 1 1 100%; }
  .toolbar { align-items: start; flex-direction: column; }
  .lead-card { grid-template-columns: 1fr; }
  .score {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    flex-direction: row;
    gap: 6px;
    align-items: baseline;
    padding: 9px 20px;
    justify-content: start;
  }
  .signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions { flex-direction: column; align-items: stretch; gap: 10px; }
}

/* ── Outcome ────────────────────────────────────────────────────────────────── */

/* One row, one press. A form that asks for more than that is a form nobody fills in,
   and an unfilled one measures nothing. */
.outcome {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
}
.outcome > span { color: var(--dim); font-size: 12.5px; margin-right: 2px; }
.outcome em { color: var(--dim); font-size: 12px; font-style: normal; }

.out {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.out:hover { color: var(--text); border-color: #3d574f; }
.out.chosen.won { background: var(--green); color: var(--green-ink); border-color: var(--green); font-weight: 700; }
.out.chosen.taken { background: #3a2f12; color: var(--amber); border-color: #6b5620; font-weight: 700; }
.out.chosen.declined,
.out.chosen.wrong { background: var(--raised); color: var(--text); border-color: #3d574f; font-weight: 700; }

@media (max-width: 680px) {
  .outcome { gap: 6px; }
  .outcome > span { flex: 1 1 100%; }
}
