/* Job lists: /matches (leads/matches.html, _filters.html, _active.html, _list.html, _card.html;
   mockup 3). Tokens only: no raw colors. Narrow-screen rules at the bottom. */

.leads-sort { margin: 0; }

/* The filter sidebar on the left, the results on the right; stacked on narrow screens. */
.leads-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
.leads-results { display: grid; gap: var(--space-4); align-content: start; min-width: 0; }

/* Sidebar (leads/_filters.html): the filter bar component (components.css), a grid cell here. */
.lead-filters { min-width: 0; margin: 0; }

.lead-filters-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.lead-filters-title { margin: 0; } /* a subsection-title */
.lead-filters-reset { font-size: var(--text-sm); }

.lead-filter-group { min-width: 0; margin: 0 0 var(--space-4); padding: 0; border: 0; }
.lead-filter-group legend { margin-bottom: var(--space-2); padding: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.lead-filter-options { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.lead-filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--control-sm);
  font-size: var(--text-sm);
  cursor: pointer;
}
.lead-filter-name { display: flex; align-items: center; gap: var(--space-2); min-width: 0; overflow-wrap: anywhere; }
.lead-filter-name input { flex: none; width: 16px; height: 16px; margin: 0; }
.lead-filter-count { flex: none; color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

.lead-filter-row { display: flex; gap: var(--space-2); min-width: 0; }
.lead-filter-row input { flex: 1 1 auto; min-width: 0; }
.lead-filter-row select { flex: 0 0 auto; width: auto; }
.lead-filter-chosen { margin-bottom: var(--space-1); }
.lead-filter-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.lead-filters-actions { margin: 0; }

/* Active filters above the list (leads/_active.html); hidden when there are none. */
.leads-active { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.leads-active:not(:has(li)) { display: none; }
.leads-active-label { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.leads-active-list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; list-style: none; }
.leads-active-clear { font-size: var(--text-sm); }

@media (max-width: 900px) {
  .leads-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
}

/* The list: one card per duplicate group. */
.lead-cards { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.lead-cards-item { min-width: 0; }

/* A card (both classes on it); the list's gap spaces them. */
.lead-card { display: grid; gap: var(--space-3); min-width: 0; margin: 0; }

/* Company, title and badges on the left; the score box on the right. */
.lead-head { display: flex; align-items: flex-start; gap: var(--space-4); }
.lead-head-text { flex: 1 1 auto; min-width: 0; }
.lead-company { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text); overflow-wrap: anywhere; }
.lead-source { font-weight: var(--weight-regular); color: var(--text-muted); }
.lead-title {
  margin: var(--space-1) 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
}
.lead-link { color: var(--text); text-decoration: none; }
.lead-link:hover { color: var(--accent-hover); text-decoration: underline; }
/* An inline block moves to the next line as a whole, and only wraps inside when wider than it. */
.lead-link-end { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.lead-link-icon { display: inline-block; margin-left: var(--space-1); color: var(--text-muted); vertical-align: -1px; }

.lead-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.lead-badges li { display: flex; min-width: 0; max-width: 100%; }
/* Long places and titles wrap inside their badge instead of running off a phone screen. */
.lead-badges .badge { white-space: normal; overflow-wrap: anywhere; }

.lead-score {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: var(--space-12);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.lead-score-value { font-size: var(--text-stat); font-weight: var(--weight-bold); line-height: var(--leading-tight); }
.lead-score-label { font-size: var(--text-2xs); font-weight: var(--weight-medium); }

/* Keyword chips: weight in the profile (good / bad), or not in it (dashed). */
.lead-terms { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.lead-term {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  max-width: 100%;
  padding: 2px var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
}
.lead-term-weight { font-variant-numeric: tabular-nums; }
.lead-term-good { background: var(--good-bg); color: var(--good-fg); }
.lead-term-bad { background: var(--bad-bg); color: var(--bad-fg); }
.lead-term-other { border: 1px dashed var(--text-muted); background: var(--surface); color: var(--text-muted); }
.lead-term-more { align-self: center; color: var(--text-muted); font-size: var(--text-xs); }

/* "Also posted": the group's other postings. */
.lead-variants { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); font-size: var(--text-sm); }
.lead-variants-label { margin: 0; color: var(--text-muted); }
.lead-variants-list { display: grid; flex: 1 1 16rem; gap: var(--space-1); min-width: 0; margin: 0; padding: 0; list-style: none; }
.lead-variants-list li { min-width: 0; overflow-wrap: anywhere; }
.lead-variant-meta { color: var(--text-muted); }

/* Actions: How we read it, Applied, Dismiss (or a marked group's badge, switch and Undo). */
.lead-mark { display: flex; margin: 0; }

/* Narrow screens */
@media (max-width: 640px) {
  .lead-filters-title { display: none; } /* the summary names the panel */
  .lead-filters-head { justify-content: flex-end; margin-bottom: var(--space-2); }
  .lead-filters-head:not(:has(a)) { display: none; }
  .lead-filter-option { min-height: var(--tap-target); }
  .lead-filters-reset, .leads-active-clear { display: inline-flex; align-items: center; min-height: var(--tap-target); }
  .lead-card { padding: var(--space-4); }
  .lead-head { gap: var(--space-3); }
  .lead-score { min-width: var(--space-10); padding: var(--space-1) var(--space-2); }
  .lead-score-value { font-size: var(--text-xl); }
  .leads-sort { flex: 1 1 auto; }
  .leads-sort .sort-select select { flex: 1 1 auto; }
}

/* "How we read it" (leads/_how_toggle.html, _how_we_read.html, how_we_read.html): the actions
   row's first button is the <details> summary; open, the panel takes the row's full width and
   the other buttons wrap below it. */
.lead-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }
.lead-how { min-width: 0; }
.lead-how[open] { flex: 1 1 100%; }
.lead-how-panel { margin-top: var(--space-3); }
.lead-how-fallback { margin: 0; font-size: var(--text-sm); }

.how-we-read { display: grid; gap: var(--space-3); min-width: 0; }
.how-we-read .table-wrap { margin: 0; }
.how-table td { vertical-align: top; overflow-wrap: anywhere; }
.how-table td:first-child { font-weight: var(--weight-semibold); white-space: nowrap; }
.how-raw { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.how-read { display: block; }
.how-score { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.how-reasons, .how-group { margin: var(--space-1) 0 0; padding: 0; list-style: none; font-size: var(--text-xs); color: var(--text-muted); }
.how-reasons li + li, .how-group li + li { margin-top: 2px; }
.how-reason-label { font-weight: var(--weight-semibold); }
.how-terms { margin-bottom: var(--space-1); }
.how-note { margin: var(--space-1) 0 0; font-size: var(--text-xs); color: var(--text-muted); }
.how-dates { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin: 0; font-size: var(--text-sm); }
.how-date { display: flex; gap: var(--space-2); }
.how-date dt { color: var(--text-muted); }
.how-date dd { margin: 0; }

@media (max-width: 640px) {
  /* The shared table turns rows into cards; these cells hold lists, so stack label and value. */
  .how-table td { display: block; text-align: left; }
  .how-table td::before { display: block; margin-bottom: var(--space-1); }
  .how-table td:first-child { white-space: normal; }
  .how-table caption { display: block; padding: 0 0 var(--space-2); }
}

/* All jobs' sign-up banner for visitors (T64) */
.leads-visitor-title { font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.leads-visitor p { margin: 0 0 var(--space-3); max-width: 65ch; }
.leads-visitor-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
