/* ============================================================
   Leads page
   ------------------------------------------------------------
   Built from the same tokens as analytics.css (colors_and_type.css /
   app-ui-refresh.css light overrides, loaded before this file): white cards,
   red accent, black text. Shares analytics.css's tab/chip/status-pill/drawer
   conventions so the two pages read as one product, and reuses the existing
   global .users-modal-* / .field / .form-grid / .btn / .icon-btn / .pill
   classes for the Add Lead modal instead of inventing a second modal system.

   Colour system for this page only (status pills, stat-card icon chips and
   avatar variants share these so the page reads as one system): a blue-grey
   for "not yet reviewed", violet for "qualified", HubSpot's own orange for
   "synced to HubSpot", plus 8 pastel avatar tones. None of this repurposes
   --pc-accent (brand red, used for primary actions/focus elsewhere on the
   page) or --pc-success/--pc-danger (used for the page's own notices).
   ============================================================ */

:root {
  --leads-blue: #2563eb;
  --leads-blue-soft: rgba(37, 99, 235, 0.1);
  --leads-blue-border: rgba(37, 99, 235, 0.28);
  --leads-violet: #7c3aed;
  --leads-violet-soft: rgba(124, 58, 237, 0.1);
  --leads-violet-border: rgba(124, 58, 237, 0.28);
  --leads-hubspot: #ff7a59;
  --leads-hubspot-soft: rgba(255, 122, 89, 0.14);
  --leads-hubspot-border: rgba(255, 122, 89, 0.36);

  --leads-avatar-bg-0: #fee2e2; --leads-avatar-fg-0: #b91c1c;
  --leads-avatar-bg-1: #fef3c7; --leads-avatar-fg-1: #b45309;
  --leads-avatar-bg-2: #d1fae5; --leads-avatar-fg-2: #047857;
  --leads-avatar-bg-3: #dbeafe; --leads-avatar-fg-3: #1d4ed8;
  --leads-avatar-bg-4: #e0e7ff; --leads-avatar-fg-4: #4338ca;
  --leads-avatar-bg-5: #f3e8ff; --leads-avatar-fg-5: #7e22ce;
  --leads-avatar-bg-6: #fce7f3; --leads-avatar-fg-6: #be185d;
  --leads-avatar-bg-7: #e0f2fe; --leads-avatar-fg-7: #0369a1;
}

/* Page-level vertical rhythm: every direct section (notices, summary cards,
   the table card, the mobile card list) gets consistent breathing room from
   this one gap, rather than each section carrying its own ad-hoc margin. */
.leads-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* The toolbar (filter/search/tabs/actions) as the table card's own header
   section -- inside the same white card as the table, not floating above it
   -- with a hairline divider separating it from the table body. Its left
   padding matches .leads-th-checkbox's inset so the Filter button lines up
   with the checkbox column below it, not the card's outer edge. */
.leads-card-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pc-border);
}

.leads-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  position: relative;
}

.leads-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.leads-search {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.leads-search svg {
  position: absolute;
  left: 11px;
  color: var(--pc-text-dim);
  pointer-events: none;
}

.leads-search input {
  min-height: 38px;
  min-width: 240px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-sm);
  background: var(--pc-bg-card);
  color: var(--pc-text);
  font-family: var(--pc-font-sans);
  font-size: 13px;
  padding: 8px 12px 8px 34px;
}

.leads-search input:focus-visible,
.leads-btn-filter:focus-visible,
.leads-tab:focus-visible {
  outline: 2px solid var(--pc-accent);
  outline-offset: 2px;
}

.leads-btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid var(--pc-border);
  background: var(--pc-bg-card);
  color: var(--pc-text);
  font-family: var(--pc-font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.leads-btn-filter.is-active {
  border-color: rgba(217, 47, 36, 0.4);
  background: rgba(217, 47, 36, 0.07);
  color: var(--pc-accent);
}

.leads-btn-filter .leads-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--pc-radius-pill);
  background: var(--pc-accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

/* ---------- Filter panel (popover) ---------- */

.leads-filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(560px, 88vw);
  background: var(--pc-bg-card);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-md);
  box-shadow: var(--pc-shadow-elev);
  padding: 16px;
}

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

.leads-filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.leads-filter-field.is-wide {
  grid-column: 1 / -1;
}

.leads-filter-field label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pc-text-dim);
}

.leads-filter-field input,
.leads-filter-field select {
  min-height: 38px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-sm);
  background: var(--pc-bg-card);
  color: var(--pc-text);
  font-family: var(--pc-font-sans);
  font-size: 13px;
  padding: 7px 10px;
}

.leads-filter-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leads-filter-date-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--pc-font-mono);
  font-size: 12.5px;
}

.leads-filter-date-row span {
  font-size: 12px;
  color: var(--pc-text-dim);
}

.leads-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--pc-border);
}

/* ---------- Summary stat cards ---------- */

.leads-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.leads-stat {
  background: var(--pc-bg-card);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  height: 100%;
}

.leads-stat-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--pc-radius-sm);
  background: rgba(217, 47, 36, 0.1);
  color: var(--pc-accent);
}

/* Each summary card's icon chip is tinted to match the pill it summarises
   (leads-status-pill.is-new/.is-qualified/.is-synced below), so the cards and
   the table read as one colour system rather than four identical red chips. */
.leads-stat-icon.is-total {
  background: rgba(217, 47, 36, 0.1);
  color: var(--pc-accent);
}

.leads-stat-icon.is-qualified {
  background: var(--leads-violet-soft);
  color: var(--leads-violet);
}

.leads-stat-icon.is-new {
  background: var(--leads-blue-soft);
  color: var(--leads-blue);
}

.leads-stat-icon.is-synced {
  background: var(--leads-hubspot-soft);
  color: var(--leads-hubspot);
}

.leads-stat-body {
  min-width: 0;
}

.leads-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pc-text-muted);
}

.leads-stat-value {
  font-family: var(--pc-font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--pc-text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.leads-stat-sub {
  font-size: 11.5px;
  color: var(--pc-text-dim);
  margin-top: 3px;
}

/* ---------- Status quick tabs ---------- */

.leads-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leads-tab {
  padding: 6px 12px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--pc-text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.leads-tab[aria-selected='true'] {
  border-color: var(--pc-border);
  background: var(--pc-bg-card-soft);
  color: var(--pc-text);
}

/* ---------- Bulk action bar (multi-select) ---------- */

.leads-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin-bottom: 10px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid rgba(217, 47, 36, 0.28);
  background: rgba(217, 47, 36, 0.05);
}

.leads-bulk-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--pc-text);
}

.leads-bulk-sep {
  width: 1px;
  height: 16px;
  background: var(--pc-border);
}

.leads-bulk-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid var(--pc-border);
  background: var(--pc-bg-card);
  color: var(--pc-text);
  font-family: var(--pc-font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.leads-bulk-action:hover:not(:disabled) {
  border-color: rgba(217, 47, 36, 0.4);
  color: var(--pc-accent);
}

.leads-bulk-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.leads-bulk-action.is-plain {
  border-color: transparent;
  background: none;
  color: var(--pc-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Table ---------- */

.leads-table th, .leads-table td {
  box-sizing: border-box;
}

.leads-th {
  text-align: left;
  text-transform: none;
  padding: 13px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--pc-text-muted);
  background: var(--pc-bg-card-soft);
  border-bottom: 1px solid var(--pc-border);
  white-space: nowrap;
}

/* Matches .leads-card-toolbar's 20px left padding, so the header checkbox
   (and every row's checkbox below it) sits at the same inset as the Filter
   button above it, not the card's outer edge. */
.leads-th-checkbox, .leads-td-checkbox {
  padding-left: 20px;
  padding-right: 4px;
  width: 36px;
}

.leads-th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  text-transform: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--pc-text-muted);
  cursor: pointer;
}

.leads-th-sort svg {
  opacity: 0.35;
}

.leads-th-sort.is-active,
.leads-th-sort.is-active svg {
  color: var(--pc-text);
  opacity: 1;
}

.leads-td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--pc-text);
  border-bottom: 1px solid var(--pc-border);
  vertical-align: middle;
}

.leads-td-muted {
  color: var(--pc-text-muted);
}

.leads-table-view tbody tr:last-child .leads-td {
  border-bottom: none;
}

.leads-table-view tbody tr:hover .leads-td {
  background: var(--pc-bg-card-soft);
}

.leads-table-view tbody tr.is-selected .leads-td {
  background: rgba(217, 47, 36, 0.04);
}

.leads-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Deterministic pastel avatar (getLeadAvatarVariant in Views2.jsx picks the
   variant from a hash of the lead's email/name, never randomly, so the same
   lead always renders the same colour). */
.leads-avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--pc-bg-card), 0 0 0 3px var(--pc-border);
}

.leads-avatar-0 { background: var(--leads-avatar-bg-0); color: var(--leads-avatar-fg-0); }
.leads-avatar-1 { background: var(--leads-avatar-bg-1); color: var(--leads-avatar-fg-1); }
.leads-avatar-2 { background: var(--leads-avatar-bg-2); color: var(--leads-avatar-fg-2); }
.leads-avatar-3 { background: var(--leads-avatar-bg-3); color: var(--leads-avatar-fg-3); }
.leads-avatar-4 { background: var(--leads-avatar-bg-4); color: var(--leads-avatar-fg-4); }
.leads-avatar-5 { background: var(--leads-avatar-bg-5); color: var(--leads-avatar-fg-5); }
.leads-avatar-6 { background: var(--leads-avatar-bg-6); color: var(--leads-avatar-fg-6); }
.leads-avatar-7 { background: var(--leads-avatar-bg-7); color: var(--leads-avatar-fg-7); }

.leads-name-text {
  min-width: 0;
}

.leads-name-primary {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--pc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.leads-name-company {
  font-size: 11.5px;
  color: var(--pc-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Bot column: a small neutral chip (matches the reference's "Auto/Home"
   style), never plain text, so it reads as metadata rather than a name. */
.leads-chip-bot {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--pc-radius-pill);
  background: var(--pc-bg-card-soft);
  border: 1px solid var(--pc-border);
  color: var(--pc-text-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* A neutral pill for "Added manually" in the Source column, so a manual lead
   reads as a distinct, deliberate state rather than an empty cell. */
.leads-pill-neutral {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--pc-radius-pill);
  background: var(--pc-bg-card-soft);
  border: 1px solid var(--pc-border);
  color: var(--pc-text-dim);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.leads-status-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.leads-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--pc-radius-pill);
  border: 1px solid var(--pc-border);
  background: var(--pc-bg-card-soft);
  color: var(--pc-text-muted);
  white-space: nowrap;
}

/* New lead: a blue-grey pill -- distinct from "qualified" (violet) and
   "synced" (HubSpot orange) by colour AND by icon/label (WCAG 1.4.1). */
.leads-status-pill.is-new {
  border-color: var(--leads-blue-border);
  background: var(--leads-blue-soft);
  color: var(--leads-blue);
}

.leads-status-pill.is-qualified {
  border-color: var(--leads-violet-border);
  background: var(--leads-violet-soft);
  color: var(--leads-violet);
}

.leads-status-pill.is-synced {
  border-color: var(--leads-hubspot-border);
  background: var(--leads-hubspot-soft);
  color: var(--leads-hubspot);
}

/* ---------- Profile completeness ---------- */

.leads-completeness {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.leads-completeness-track {
  display: inline-block;
  width: 52px;
  height: 6px;
  border-radius: var(--pc-radius-pill);
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.leads-completeness-fill {
  display: block;
  height: 100%;
  border-radius: var(--pc-radius-pill);
  background: var(--pc-text-dim);
}

.leads-completeness.is-full .leads-completeness-fill {
  background: var(--pc-success);
}

.leads-completeness.is-partial .leads-completeness-fill {
  background: var(--pc-warning);
}

.leads-completeness-value {
  font-family: var(--pc-font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--pc-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Row "more" menu ---------- */

.leads-row-menu {
  position: relative;
  display: inline-flex;
}

.leads-row-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--pc-text-muted);
  cursor: pointer;
}

.leads-row-menu-btn:hover,
.leads-row-menu-btn.is-active {
  border-color: var(--pc-border);
  background: var(--pc-bg-card-soft);
  color: var(--pc-text);
}

.leads-row-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 190px;
  background: var(--pc-bg-card);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-sm);
  box-shadow: var(--pc-shadow-elev);
  padding: 6px;
}

.leads-row-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--pc-radius-xs);
  border: none;
  background: none;
  color: var(--pc-text);
  font-family: var(--pc-font-sans);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.leads-row-menu-item:hover:not(:disabled) {
  background: var(--pc-bg-card-soft);
}

.leads-row-menu-item:disabled {
  color: var(--pc-text-dim);
  cursor: not-allowed;
}

.leads-row-menu-item.is-danger {
  color: var(--pc-danger);
}

/* ---------- Pagination ---------- */

.leads-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--pc-border);
  flex-wrap: wrap;
}

.leads-pagination-info {
  font-size: 12.5px;
  color: var(--pc-text-muted);
}

.leads-pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.leads-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--pc-radius-sm);
  border: 1px solid var(--pc-border);
  background: var(--pc-bg-card);
  color: var(--pc-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.leads-pagination-btn:disabled {
  color: var(--pc-text-dim);
  cursor: not-allowed;
  opacity: 0.6;
}

.leads-pagination-btn.is-active {
  border-color: rgba(217, 47, 36, 0.4);
  background: rgba(217, 47, 36, 0.07);
  color: var(--pc-accent);
}

/* ---------- Mobile cards ---------- */

/* Lives inside .lead-card-head (display:flex, app-ui-production.css) as its
   last child: [avatar][name/bot/region, flex:1 min-width:0][status pills].
   align-self:flex-start pulls it up to the name row instead of the parent's
   own align-items:center, and margin-left:auto pins it to the right without
   needing justify-content on the shared .lead-card-head rule. */
.lead-card-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  align-self: flex-start;
  margin-left: auto;
  flex: 0 0 auto;
  gap: 5px;
}

.lead-card-status .leads-status-pill {
  white-space: nowrap;
}

.lead-card-company {
  font-size: 11.5px;
  color: var(--pc-text-dim);
  margin-top: 1px;
}

.lead-card-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--pc-border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lead-card-actions button {
  flex: 1 1 auto;
}

/* ---------- Empty states ---------- */

.leads-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--pc-text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.leads-empty strong {
  display: block;
  color: var(--pc-text);
  font-size: 14.5px;
  margin-bottom: 6px;
}

/* ---------- Add Lead modal ---------- */
/* Reuses the app's existing .users-modal-backdrop/.users-modal/.field/
   .form-grid shell (see UsersPage.jsx) rather than a second modal system;
   these classes only add the two-column field grouping, the read-only
   company preview, the status segmented control and internal scrolling. */

/* .users-modal already sets max-height: calc(100vh - 48px) and overflow:
   auto (styles.css), so the modal as a whole scrolls internally once it is
   taller than the viewport -- no separate scroll container needed here. */
.leads-add-modal {
  width: min(620px, 100%);
}

.leads-add-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pc-text-dim);
  margin: 18px 0 8px;
}

.leads-add-section-label:first-child {
  margin-top: 2px;
}

.leads-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.leads-add-full {
  grid-column: 1 / -1;
}

.leads-add-hint {
  display: block;
  font-size: 11.5px;
  color: var(--pc-text-dim);
  margin-top: 4px;
  line-height: 1.45;
}

.leads-add-required {
  color: var(--pc-accent);
  font-weight: 700;
}

.leads-add-segmented {
  display: inline-flex;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-sm);
  overflow: hidden;
}

.leads-add-segment {
  padding: 8px 14px;
  border: none;
  border-right: 1px solid var(--pc-border);
  background: var(--pc-bg-card);
  color: var(--pc-text-muted);
  font-family: var(--pc-font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.leads-add-segment:last-child {
  border-right: none;
}

.leads-add-segment.is-active {
  background: rgba(217, 47, 36, 0.09);
  color: var(--pc-accent);
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .leads-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  /* The toolbar stays visible on mobile (only .leads-table-view, the actual
     table, collapses in favour of .leads-card-view) -- stacked full-width
     controls, a horizontally-scrollable tab strip, and compact action
     buttons instead of the desktop's single wide row. */
  .leads-card-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px;
  }
  .leads-toolbar-left,
  .leads-toolbar-right {
    width: 100%;
    margin-left: 0;
  }
  .leads-toolbar-left {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .leads-search,
  .leads-search input {
    width: 100%;
  }
  .leads-btn-filter {
    width: 100%;
    justify-content: center;
  }
  .leads-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .leads-tab {
    flex: 0 0 auto;
  }
  .leads-toolbar-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .leads-toolbar-right .btn {
    padding: 8px 10px;
    font-size: 12.5px;
    justify-content: center;
  }
  .leads-filter-panel {
    width: 100%;
    left: 0;
    right: 0;
  }
  .leads-filter-grid {
    grid-template-columns: 1fr;
  }
  .leads-stats {
    grid-template-columns: 1fr 1fr;
  }
  .leads-pagination {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .leads-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .leads-add-grid {
    grid-template-columns: 1fr;
  }
  .leads-add-full {
    grid-column: auto;
  }
}

/* Fit all columns at common laptop widths (1280-1440px) without sideways
   scrolling: tighter cell padding, and long emails truncate with the full
   address on hover. Below 1180px the table still scrolls inside its card. */
.leads-table .leads-th,
.leads-table .leads-td {
  padding-left: 10px;
  padding-right: 10px;
}

.leads-table .leads-th-checkbox,
.leads-table .leads-td-checkbox {
  padding-left: 20px;
  padding-right: 4px;
}

.leads-td-email {
  max-width: 190px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.leads-table .leads-completeness-track {
  width: 40px;
}

/* ---------- Mobile lead card ----------
   Header: avatar, name and one muted line (company, else region), status on
   the right. Then tappable email/phone, a 2x2 details grid and the profile
   completeness bar. */
.leads-card-view .lead-card-head {
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.leads-card-view .lead-card-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.leads-card-view .lead-card-name {
  line-height: 1.25;
}

.leads-card-view .lead-card-company {
  font-size: 12.5px;
  color: var(--pc-text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-card-contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--pc-border);
}

.lead-card-contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 13.5px;
  color: var(--pc-text);
  text-decoration: none;
}

.lead-card-contact-link svg {
  flex: none;
  color: var(--pc-text-muted);
}

.lead-card-contact-link span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lead-card-contact-link.is-empty {
  color: var(--pc-text-dim);
}

.lead-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--pc-border);
}

.lead-card-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lead-card-meta-item > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--pc-text-muted);
}

.lead-card-meta-item > b {
  font-size: 13px;
  font-weight: 500;
  color: var(--pc-text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lead-card-completeness {
  display: flex;
  width: 100%;
  padding: 12px 0 14px;
  border-top: 1px solid var(--pc-border);
}

.lead-card-completeness-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--pc-text-muted);
}

.lead-card-completeness .leads-completeness-track {
  flex: 1;
  width: auto;
}
