/*
 * RingCraft Design V1 — Leads and lead detail
 * Cosmetics only: existing IDs, classes, events and DOM structure remain untouched.
 */

/* Operational toolbar */
.leads-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.leads-topbar-actions .btn {
  gap: 7px;
  letter-spacing: -.01em;
}

.filters-bar:has(#f-search) {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) repeat(6, minmax(128px, 1fr));
  gap: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background:
    linear-gradient(90deg, var(--rc-blue) 0 3px, transparent 3px),
    var(--rc-surface);
  border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius-md);
  box-shadow: var(--rc-shadow-sm);
}

.filters-bar:has(#f-search) input,
.filters-bar:has(#f-search) select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-inline: 10px;
  font-size: 12px;
}

#f-search {
  grid-column: span 1;
  font-size: 13px;
  font-weight: 550;
}

#f-search::placeholder { color: var(--rc-muted); }

#f-min-score,
#f-min-reviews,
#f-max-reviews,
.leads-f-min-score,
.leads-f-min-reviews,
.leads-f-max-reviews {
  font-family: var(--rc-font-mono);
  font-variant-numeric: tabular-nums;
}

.leads-actions-cell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.leads-actions-cell .btn {
  min-width: 32px;
  min-height: 30px;
  padding: 5px 8px;
}

/* Selection receipt */
#bulk-bar,
.bulk-bar {
  background: color-mix(in srgb, var(--rc-navy) 95%, var(--rc-blue));
  border: 1px solid color-mix(in srgb, var(--rc-blue) 36%, var(--rc-navy));
  color: #fff;
  box-shadow: 0 16px 42px rgba(15, 21, 36, .24);
  border-radius: 14px;
}

#bulk-count {
  font-family: var(--rc-font-mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.select-all-banner-text,
.select-all-banner-btn,
.select-all-banner-clear {
  font-size: 12px;
}

.select-all-banner-btn {
  color: var(--rc-blue);
  font-weight: 700;
}

/* Leads data surface */
#leads-table-wrap,
.leads-table-wrap,
.table-wrap:has(#select-all-leads) {
  overflow: auto;
  background: var(--rc-surface);
  border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius-md);
  box-shadow: var(--rc-shadow-sm);
  scrollbar-color: var(--rc-line-strong) transparent;
}

#leads-table-wrap table,
.table-wrap:has(#select-all-leads) table {
  min-width: 1050px;
  border-collapse: separate;
  border-spacing: 0;
}

#leads-table-wrap thead th,
.table-wrap:has(#select-all-leads) thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--rc-surface-muted) 82%, var(--rc-surface));
  border-bottom: 1px solid var(--rc-line-strong);
  color: var(--rc-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
}

#leads-table-wrap tbody td,
.table-wrap:has(#select-all-leads) tbody td {
  padding: 10px 12px;
  background: var(--rc-surface);
  border-bottom: 1px solid var(--rc-line);
  vertical-align: middle;
  transition: background var(--rc-motion-fast);
}

#leads-table-wrap tbody tr:last-child td,
.table-wrap:has(#select-all-leads) tbody tr:last-child td {
  border-bottom: 0;
}

#leads-table-wrap tbody tr:hover td,
.table-wrap:has(#select-all-leads) tbody tr:hover td {
  background: color-mix(in srgb, var(--rc-blue-soft) 40%, var(--rc-surface));
}

#leads-table-wrap tbody tr:focus-within td {
  background: color-mix(in srgb, var(--rc-blue-soft) 55%, var(--rc-surface));
}

.leads-business-cell {
  min-width: 210px;
}

.leads-business-info {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.leads-logo-tile {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: var(--rc-blue);
  background: var(--rc-blue-soft);
  border: 1px solid color-mix(in srgb, var(--rc-blue) 20%, var(--rc-line));
  border-radius: 10px;
  font-weight: 750;
}

.leads-business-name {
  overflow: hidden;
  color: var(--rc-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leads-industry-sub,
.leads-assigned-none,
.leads-email-cell,
.text-muted {
  color: var(--rc-muted);
}

.leads-phone-link,
.leads-email-link {
  color: var(--rc-ink);
  text-decoration: none;
}

.leads-phone-link {
  font-family: var(--rc-font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.leads-phone-link:hover,
.leads-email-link:hover {
  color: var(--rc-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.leads-phone-type,
.leads-total-calls {
  font-family: var(--rc-font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.leads-score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 26px;
  padding: 4px 7px;
  color: var(--rc-ink);
  background: var(--rc-surface-muted);
  border: 1px solid var(--rc-line);
  border-radius: 999px;
  font-family: var(--rc-font-mono);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.leads-score-chip.high {
  color: var(--rc-positive);
  background: var(--rc-positive-soft);
  border-color: color-mix(in srgb, var(--rc-positive) 30%, transparent);
}

.leads-followup-badge {
  color: var(--rc-blue);
  background: var(--rc-blue-soft);
  border-color: color-mix(in srgb, var(--rc-blue) 25%, transparent);
  font-family: var(--rc-font-mono);
  font-variant-numeric: tabular-nums;
}

.leads-deleted-badge,
.leads-row-deleted {
  opacity: .68;
}

.leads-row-deleted td {
  background: color-mix(in srgb, var(--rc-danger-soft) 25%, var(--rc-surface)) !important;
}

/* Pagination */
#leads-pagination,
.leads-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 2px;
}

.leads-pagination-info {
  color: var(--rc-muted);
  font-family: var(--rc-font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.page-btn {
  min-width: 34px;
  min-height: 34px;
  background: var(--rc-surface);
  border: 1px solid var(--rc-line);
  border-radius: 8px;
  color: var(--rc-ink);
  transition: background var(--rc-motion-fast), border-color var(--rc-motion-fast), color var(--rc-motion-fast), transform var(--rc-motion-fast);
}

.page-btn:hover {
  color: var(--rc-blue);
  background: var(--rc-blue-soft);
  border-color: color-mix(in srgb, var(--rc-blue) 38%, var(--rc-line));
  transform: translateY(-1px);
}

.page-btn.active {
  color: #fff;
  background: var(--rc-blue);
  border-color: var(--rc-blue);
}

/* Premium lead drawer */
#detail-panel {
  width: min(520px, 100vw);
  background: var(--rc-surface);
  border-left: 1px solid var(--rc-line);
  box-shadow: -24px 0 64px rgba(15, 21, 36, .16);
}

#detail-panel .detail-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 18px 20px 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--rc-blue-soft) 55%, var(--rc-surface)), var(--rc-surface) 54%);
  border-bottom: 1px solid var(--rc-line);
}

#detail-title {
  color: var(--rc-ink);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.025em;
}

.detail-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--rc-muted);
  background: var(--rc-surface);
  border: 1px solid var(--rc-line);
  border-radius: 9px;
  transition: color var(--rc-motion-fast), background var(--rc-motion-fast), border-color var(--rc-motion-fast), transform var(--rc-motion-fast);
}

.detail-close:hover {
  color: var(--rc-danger);
  background: var(--rc-danger-soft);
  border-color: color-mix(in srgb, var(--rc-danger) 28%, var(--rc-line));
  transform: rotate(3deg);
}

#detail-panel .tabs {
  position: sticky;
  top: 70px;
  z-index: 4;
  display: flex;
  gap: 3px;
  padding: 8px 16px;
  overflow-x: auto;
  background: color-mix(in srgb, var(--rc-surface) 94%, transparent);
  border-bottom: 1px solid var(--rc-line);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
}

#detail-panel .tabs::-webkit-scrollbar { display: none; }

#detail-panel .tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--rc-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

#detail-panel .tab:hover {
  color: var(--rc-ink);
  background: var(--rc-surface-muted);
}

#detail-panel .tab.active {
  color: var(--rc-blue);
  background: var(--rc-blue-soft);
  border-color: color-mix(in srgb, var(--rc-blue) 20%, var(--rc-line));
}

#detail-panel .detail-body {
  padding: 18px 20px 32px;
}

.detail-section,
.ai-card-detail,
.call-card-detail,
.transcript-card,
.note-item {
  background: var(--rc-surface);
  border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius-md);
  box-shadow: none;
}

.detail-section {
  padding: 14px;
  margin-bottom: 12px;
}

.detail-field {
  display: grid;
  grid-template-columns: minmax(105px, .65fr) minmax(0, 1.35fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rc-line) 75%, transparent);
}

.detail-field:last-child { border-bottom: 0; }

.detail-field .key {
  color: var(--rc-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.detail-field .val {
  min-width: 0;
  color: var(--rc-ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-field .val a { color: var(--rc-blue); }

#detail-panel [href^="tel:"],
#detail-panel [data-phone],
#detail-call-status {
  font-family: var(--rc-font-mono);
  font-variant-numeric: tabular-nums;
}

#detail-panel .tag {
  color: var(--rc-blue);
  background: var(--rc-blue-soft);
  border: 1px solid color-mix(in srgb, var(--rc-blue) 22%, transparent);
  border-radius: 999px;
}

.note-item,
.call-card-detail,
.ai-card-detail {
  padding: 13px;
  margin-bottom: 9px;
}

.note-meta,
.transcript-header {
  color: var(--rc-muted);
  font-family: var(--rc-font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.note-add {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--rc-surface-muted);
  border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius-md);
}

#new-note-text,
#lc-notes {
  min-height: 92px;
  resize: vertical;
}

#lead-activity-list {
  position: relative;
  padding-left: 12px;
  border-left: 1px solid var(--rc-line);
}

/* Mobile keeps actions visible without changing behavior */
@media (max-width: 1280px) {
  .filters-bar:has(#f-search) {
    grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(132px, 1fr));
  }
}

@media (max-width: 900px) {
  .filters-bar:has(#f-search) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #f-search { grid-column: 1 / -1; }

  #detail-panel {
    width: min(500px, calc(100vw - 24px));
  }
}

@media (max-width: 560px) {
  .leads-topbar-actions {
    justify-content: stretch;
  }

  .leads-topbar-actions .btn {
    flex: 1 1 auto;
  }

  .filters-bar:has(#f-search) {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  #f-search { grid-column: auto; }

  #detail-panel {
    width: 100vw;
    border-left: 0;
  }

  #detail-panel .detail-header {
    padding-inline: 14px;
  }

  #detail-panel .tabs {
    top: 66px;
    padding-inline: 10px;
  }

  #detail-panel .detail-body {
    padding: 14px 12px 28px;
  }

  .detail-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #bulk-bar,
  .bulk-bar {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #leads-table-wrap tbody tr,
  #detail-panel,
  .detail-section {
    animation: rc-leads-enter 180ms ease-out both;
  }

  #leads-table-wrap tbody tr:nth-child(n+9) { animation: none; }

  @keyframes rc-leads-enter {
    from { opacity: .68; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
  }
}


/* V1 refinement — informational lead data uses brand blue; green stays semantic. */
.leads-score-chip.high,
#detail-panel .detail-field .val[style*="green"],
#detail-panel .detail-field .val[style*="success"] {
  color: var(--rc-blue) !important;
  background: var(--rc-blue-soft) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 28%, var(--rc-line)) !important;
}

#leads-table-wrap .leads-assigned-name,
#leads-table-wrap [class*="assigned"]:not(.badge):not(select),
#leads-table-wrap td[style*="green"] {
  color: var(--rc-blue) !important;
}

/* Notes composer — aligned writing surface with a deliberate action height. */
#detail-panel .note-add {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end !important;
  gap: 9px !important;
  padding: 12px !important;
}

#detail-panel #new-note-text {
  min-width: 0 !important;
  width: 100% !important;
  min-height: 78px !important;
  padding: 11px 12px !important;
  color: var(--rc-ink) !important;
  background: var(--rc-surface) !important;
  border: 1px solid var(--rc-line) !important;
  border-radius: 10px !important;
  font: 500 12px/1.55 var(--rc-font-ui) !important;
}

#detail-panel #new-note-text:focus {
  border-color: var(--rc-blue) !important;
  box-shadow: var(--rc-focus) !important;
  outline: none !important;
}

#detail-panel .note-add > .btn {
  align-self: end !important;
  min-width: 72px !important;
  min-height: 42px !important;
  height: 42px !important;
  justify-content: center !important;
}

@media (max-width: 440px) {
  #detail-panel .note-add {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #detail-panel .note-add > .btn {
    width: 100% !important;
  }
}


/* All Leads precision repair — filter workspace 2026-08-07 */
/*
 * The legacy compatibility theme owns .filters-bar with !important flex rules.
 * This page-scoped layer restores the intended grid without affecting Pipeline
 * or other filter bars and keeps every existing filter ID/handler intact.
 */
#content > .filters-bar:has(> #f-search) {
  display: grid !important;
  grid-template-columns: minmax(250px, 1.75fr) repeat(6, minmax(118px, 1fr)) !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 12px !important;
  margin-bottom: 12px !important;
  overflow: visible;
  background:
    linear-gradient(90deg, var(--rc-blue) 0 3px, transparent 3px),
    var(--rc-surface) !important;
  border-color: var(--rc-line) !important;
  border-radius: var(--rc-radius-md) !important;
  box-shadow: var(--rc-shadow-sm);
}

#content > .filters-bar:has(> #f-search) > input,
#content > .filters-bar:has(> #f-search) > select {
  width: 100% !important;
  min-width: 0 !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 7px 30px 7px 10px !important;
  color: var(--rc-ink) !important;
  background-color: var(--rc-surface-muted) !important;
  border: 1px solid var(--rc-line) !important;
  border-radius: 9px !important;
  font: 550 12px/1.2 var(--rc-font-ui) !important;
  text-overflow: ellipsis;
  transition:
    border-color var(--rc-motion-fast),
    background-color var(--rc-motion-fast),
    box-shadow var(--rc-motion-fast);
}

#content > .filters-bar:has(> #f-search) > input {
  padding-right: 10px !important;
  cursor: text !important;
}

#content > .filters-bar:has(> #f-search) > input:hover,
#content > .filters-bar:has(> #f-search) > select:hover {
  background-color: var(--rc-surface) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 32%, var(--rc-line)) !important;
}

#content > .filters-bar:has(> #f-search) > input:focus,
#content > .filters-bar:has(> #f-search) > select:focus {
  background-color: var(--rc-surface) !important;
  border-color: var(--rc-blue) !important;
  box-shadow: var(--rc-focus) !important;
  outline: none !important;
}

/* Non-default controls read as active filters without adding JavaScript state. */
#content > .filters-bar:has(> #f-search) > select:has(option:checked:not([value=""])),
#content > .filters-bar:has(> #f-search) > input:not(:placeholder-shown) {
  color: var(--rc-blue) !important;
  background-color: var(--rc-blue-soft) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 42%, var(--rc-line)) !important;
  font-weight: 650 !important;
}

#content > .filters-bar:has(> #f-search) > #f-search {
  grid-column: auto !important;
  font-size: 13px !important;
}

#content > .filters-bar:has(> #f-search) > .leads-deleted-label {
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  justify-content: center;
  color: var(--rc-muted) !important;
  background: var(--rc-surface-muted);
  border: 1px solid var(--rc-line);
  border-radius: 9px;
}

#content > .filters-bar:has(> #f-search) > .leads-deleted-label:has(input:checked) {
  color: var(--rc-danger) !important;
  background: var(--rc-danger-soft);
  border-color: color-mix(in srgb, var(--rc-danger) 34%, var(--rc-line));
}

#content > .filters-bar:has(> #f-search) > .btn {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  justify-content: center;
}

@media (max-width: 1500px) {
  #content > .filters-bar:has(> #f-search) {
    grid-template-columns: minmax(230px, 1.7fr) repeat(4, minmax(126px, 1fr)) !important;
  }
}

@media (max-width: 1080px) {
  #content > .filters-bar:has(> #f-search) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #content > .filters-bar:has(> #f-search) > #f-search {
    grid-column: span 2 !important;
  }
}

@media (max-width: 760px) {
  #content > .filters-bar:has(> #f-search) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 10px !important;
  }

  #content > .filters-bar:has(> #f-search) > #f-search {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 480px) {
  #content > .filters-bar:has(> #f-search) {
    grid-template-columns: 1fr !important;
  }

  #content > .filters-bar:has(> #f-search) > #f-search {
    grid-column: auto !important;
  }
}

html[data-theme="dark"] #content > .filters-bar:has(> #f-search) > input,
html[data-theme="dark"] #content > .filters-bar:has(> #f-search) > select,
html[data-theme="dark"] #content > .filters-bar:has(> #f-search) > .leads-deleted-label {
  background-color: var(--rc-surface-muted) !important;
  border-color: var(--rc-line) !important;
  color: var(--rc-ink) !important;
}

html[data-theme="dark"] #content > .filters-bar:has(> #f-search) > select:has(option:checked:not([value=""])),
html[data-theme="dark"] #content > .filters-bar:has(> #f-search) > input:not(:placeholder-shown) {
  color: var(--rc-blue-bright) !important;
  background-color: color-mix(in srgb, var(--rc-blue) 16%, var(--rc-surface)) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 46%, var(--rc-line)) !important;
}


/* All Leads information architecture — progressive filters + business-first table */
.leads-filter-workspace {
  margin-bottom: 12px;
}

#content > .leads-filter-workspace > .filters-bar {
  display: block !important;
  padding: 12px !important;
  margin: 0 !important;
  overflow: hidden;
  background:
    linear-gradient(90deg, var(--rc-blue) 0 3px, transparent 3px),
    var(--rc-surface) !important;
  border: 1px solid var(--rc-line) !important;
  border-radius: var(--rc-radius-md) !important;
  box-shadow: var(--rc-shadow-sm);
}

.leads-filter-primary {
  display: grid;
  grid-template-columns: minmax(260px, 1.65fr) repeat(5, minmax(118px, 1fr)) minmax(142px, auto);
  align-items: end;
  gap: 8px;
}

.leads-filter-primary > label {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.leads-filter-label {
  padding-left: 2px;
  color: var(--rc-muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .075em;
  line-height: 1;
  text-transform: uppercase;
}

.leads-filter-primary input,
.leads-filter-primary select,
.leads-filter-grid input,
.leads-filter-grid select {
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 8px 30px 8px 11px !important;
  color: var(--rc-ink) !important;
  background-color: var(--rc-surface-muted) !important;
  border: 1px solid var(--rc-line) !important;
  border-radius: 9px !important;
  font: 560 12px/1.2 var(--rc-font-ui) !important;
  text-overflow: ellipsis;
  transition: border-color var(--rc-motion-fast), background-color var(--rc-motion-fast), box-shadow var(--rc-motion-fast);
}

.leads-filter-primary input {
  padding-right: 11px !important;
}

.leads-filter-primary input:hover,
.leads-filter-primary select:hover,
.leads-filter-grid input:hover,
.leads-filter-grid select:hover {
  background-color: var(--rc-surface) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 32%, var(--rc-line)) !important;
}

.leads-filter-primary input:focus,
.leads-filter-primary select:focus,
.leads-filter-grid input:focus,
.leads-filter-grid select:focus {
  background-color: var(--rc-surface) !important;
  border-color: var(--rc-blue) !important;
  box-shadow: var(--rc-focus) !important;
  outline: none !important;
}

.leads-filter-primary select:has(option:checked:not([value=""])),
.leads-filter-grid select:has(option:checked:not([value=""])),
.leads-filter-primary input:not(:placeholder-shown),
.leads-filter-grid input:not(:placeholder-shown) {
  color: var(--rc-blue) !important;
  background-color: var(--rc-blue-soft) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 42%, var(--rc-line)) !important;
  font-weight: 680 !important;
}

.leads-more-filters-btn {
  position: relative;
  min-width: 142px;
  min-height: 40px;
  height: 40px;
  justify-content: center;
  padding-inline: 11px !important;
  color: var(--rc-ink);
  background: var(--rc-surface) !important;
  border: 1px solid var(--rc-line-strong) !important;
  border-radius: 9px !important;
  white-space: nowrap;
}

.leads-more-filters-btn:hover,
.leads-more-filters-btn.is-open {
  color: var(--rc-blue);
  background: var(--rc-blue-soft) !important;
  border-color: color-mix(in srgb, var(--rc-blue) 38%, var(--rc-line)) !important;
}

.leads-filter-sliders {
  color: var(--rc-blue);
  font-size: 15px;
  line-height: 1;
}

.leads-filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding-inline: 5px;
  color: var(--rc-muted);
  background: var(--rc-surface-muted);
  border: 1px solid var(--rc-line);
  border-radius: 999px;
  font: 650 9px/1 var(--rc-font-mono);
}

.leads-filter-chevron {
  margin-left: 1px;
  color: var(--rc-muted);
  font-size: 14px;
  transition: transform var(--rc-motion-fast);
}

.leads-more-filters-btn.is-open .leads-filter-chevron {
  transform: rotate(180deg);
}

.leads-advanced-filters[hidden] {
  display: none !important;
}

.leads-advanced-filters {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rc-line);
}

.leads-advanced-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.leads-advanced-heading > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.leads-advanced-heading strong {
  color: var(--rc-ink);
  font-size: 11px;
  font-weight: 720;
}

.leads-advanced-heading span {
  overflow: hidden;
  color: var(--rc-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leads-clear-filters {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: var(--rc-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: 650 10px/1.2 var(--rc-font-ui);
  cursor: pointer;
}

.leads-clear-filters:hover {
  color: var(--rc-danger);
  background: var(--rc-danger-soft);
}

.leads-filter-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.leads-filter-grid .leads-deleted-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 9px;
  color: var(--rc-muted);
  background: var(--rc-surface-muted);
  border: 1px solid var(--rc-line);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 620;
  white-space: nowrap;
}

.leads-filter-grid .leads-deleted-label:has(input:checked) {
  color: var(--rc-danger);
  background: var(--rc-danger-soft);
  border-color: color-mix(in srgb, var(--rc-danger) 34%, var(--rc-line));
}

/* Repair the actual sibling structure: logo + information, then let names breathe. */
#leads-table-wrap table,
.table-wrap:has(#select-all-leads) table {
  min-width: 1220px;
}

#leads-table-wrap td:has(> .leads-business-cell),
.table-wrap:has(#select-all-leads) td:has(> .leads-business-cell) {
  width: 26%;
  min-width: 300px;
}

.leads-business-cell {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
}

.leads-business-info {
  display: block;
  min-width: 0;
}

.leads-logo-tile {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 15px;
}

.leads-business-name {
  display: block;
  max-width: 100%;
  color: var(--rc-ink) !important;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.28;
  letter-spacing: -.018em;
}

.leads-business-name:hover {
  color: var(--rc-blue) !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.leads-industry-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: var(--rc-muted);
  font-size: 10px;
  font-weight: 520;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.leads-sub-sep {
  color: var(--rc-line-strong);
}

#leads-table-wrap .leads-email-cell {
  min-width: 170px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leads-table-wrap .leads-phone-link {
  font-size: 12px;
  font-weight: 600;
}

#leads-table-wrap tbody tr {
  min-height: 62px;
}

@media (max-width: 1500px) {
  .leads-filter-primary {
    grid-template-columns: minmax(240px, 1.7fr) repeat(3, minmax(125px, 1fr)) minmax(142px, auto);
  }

  .leads-filter-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .leads-filter-primary {
    grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(120px, 1fr)) minmax(138px, auto);
  }

  .leads-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .leads-filter-primary {
    grid-template-columns: minmax(0, 1fr) minmax(132px, .45fr);
  }

  .leads-search-field {
    grid-column: 1 / -1;
  }

  .leads-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leads-advanced-heading > div {
    display: grid;
    gap: 3px;
  }
}

@media (max-width: 480px) {
  #content > .leads-filter-workspace > .filters-bar {
    padding: 10px !important;
  }

  .leads-filter-primary,
  .leads-filter-grid {
    grid-template-columns: 1fr;
  }

  .leads-search-field {
    grid-column: auto;
  }

  .leads-more-filters-btn {
    width: 100%;
  }

  .leads-advanced-heading span {
    display: none;
  }
}

html[data-theme="dark"] .leads-filter-primary input,
html[data-theme="dark"] .leads-filter-primary select,
html[data-theme="dark"] .leads-filter-grid input,
html[data-theme="dark"] .leads-filter-grid select,
html[data-theme="dark"] .leads-filter-grid .leads-deleted-label {
  color: var(--rc-ink) !important;
  background-color: var(--rc-surface-muted) !important;
  border-color: var(--rc-line) !important;
}

@media (prefers-reduced-motion: reduce) {
  .leads-filter-chevron {
    transition: none;
  }
}
