/* Leads module — presentation modes (Status / Kanban / Sequence / List), status focus, cooling/archive.
   Tokens only (see docs/DESIGN-SYSTEM.md). */
/* Page header — title + summary left, primary actions right, gear pinned upper-right */
.ld-page-head { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; padding-right: 30px; }
.ld-page-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.ld-h1 { font-size: 20px; font-weight: 700; line-height: 1.2; margin: 0; color: var(--color-text-primary); }
.ld-page-sum { font-size: 12px; color: var(--color-text-secondary); }
.ld-page-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
/* Gear = a real button, sized to match the neighboring .btn controls (was a bare 15px glyph that
   read as an artifact next to full-height buttons). */
.ld-gearbtn { position: absolute; top: 0; right: 0; display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; font-size: 14px; line-height: 1; cursor: pointer;
  color: var(--color-text-secondary); background: var(--surface-2);
  border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-md); }
.ld-gearbtn:hover { color: var(--color-text-primary); border-color: var(--color-text-tertiary); }
.cfg-split-row { display: flex; align-items: center; gap: 8px; }
.cfg-split-row input[type="range"] { flex: 1; accent-color: var(--accent); }

/* Pipeline-config popover (gear) — same anatomy as .sq-viewcfg */
.ld-viewcfg { position: fixed; z-index: 1000; min-width: 280px; max-width: 360px; max-height: calc(100vh - 24px); overflow-y: auto; background: var(--surface-1); border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-2); padding: 12px 14px; }
.ld-viewcfg .ld-cfg-title { font-size: 11px; font-weight: 700; color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.ld-viewcfg .cfg-field { display: block; margin-bottom: 8px; }

/* Inline SVG icons (currentColor) */
.ld-ico { vertical-align: -2px; flex: none; }

.lead-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.lead-modes { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--color-border-secondary); border-radius: 8px; padding: 2px; }
.lead-mode { background: none; border: 0; color: var(--color-text-secondary); padding: 3px 11px; border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit; }
.lead-mode:hover { color: var(--color-text-primary); }
.lead-mode.active { background: var(--surface-3); color: var(--color-text-primary); font-weight: 600; }
.lead-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.lead-chip { background: var(--surface-1); border: 1px solid var(--color-border-secondary); color: var(--color-text-secondary); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 11px; font-family: inherit; }
.lead-chip:hover { color: var(--color-text-primary); border-color: var(--accent); }
.lead-chip.active { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.lead-chip-n { opacity: .7; font-variant-numeric: tabular-nums; margin-left: 2px; }
/* Open (opportunity) lead — Thumbtack-surfaced, unassigned/unpaid. Amber "attention" accent so it
   reads as an opportunity distinct from the active pipeline (S14-OPENLEAD). */
.flag.open-lead { background: var(--color-background-warn); color: var(--color-text-warn); border: 1px solid var(--color-text-warn); font-weight: 700; letter-spacing: .04em; }
.lead-chip.open-leads-chip { color: var(--color-text-warn); border-color: var(--color-text-warn); font-weight: 600; }
.lead-chip.open-leads-chip:hover { border-color: var(--color-text-warn); }
.lead-chip.open-leads-chip.active { background: var(--color-background-warn); color: var(--color-text-warn); border-color: var(--color-text-warn); }
/* "+ N empty" toggle chip — quieter than real filters */
.lead-chip.lead-chip-empties { color: var(--color-text-tertiary); border-style: dashed; }
/* On phones the chip bar becomes a single horizontally-scrollable rail (was a 4-row wall pushing
   the list below the fold), and the search input takes the free width. */
@media (max-width: 680px) {
  .lead-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .lead-chip { flex: none; }
  .lead-tools { flex-wrap: nowrap; }
  .lead-tools #lead-q { flex: 1; min-width: 0; }
}
.lead-tools { display: flex; gap: 6px; margin-left: auto; }
.lead-tools input { min-width: 120px; }

/* Status mode — sticky section headers, click to focus + process */
.lead-sect { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-secondary); padding: 8px 4px 4px; cursor: pointer; border-bottom: 1px solid var(--color-border-tertiary); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.lead-sect:hover { color: var(--accent); }

/* Focus mode — one list to clear */
.focus-head { display: flex; align-items: center; gap: 10px; padding: 8px 11px; margin-bottom: 8px; background: var(--accent-dim); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 8px; }
.focus-done { padding: 28px 12px; text-align: center; color: var(--accent); font-weight: 600; }
.lead-adv { padding: 2px 9px; margin-left: 4px; }

/* Kanban mode */
.lead-kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.lk-col { flex: 0 0 205px; background: var(--surface-1); border: 1px solid var(--color-border-secondary); border-radius: 10px; padding: 8px; min-height: 90px; }
.lk-head { font-size: 11px; font-weight: 700; color: var(--color-text-secondary); padding: 2px 4px 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--color-border-tertiary); margin-bottom: 8px; }
.lk-head:hover { color: var(--accent); }
.lk-card { background: var(--surface-2); border: 1px solid var(--color-border-tertiary); border-radius: 8px; padding: 8px; margin-bottom: 8px; cursor: pointer; }
.lk-card:hover { border-color: var(--accent); }
.lk-name { font-weight: 600; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.lk-sub { font-size: 10px; margin: 3px 0; }
.lk-flags { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.lk-acts { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }
.lk-acts .btn { padding: 1px 9px; }

/* Activity timeline entries — now clickable to full detail */
.tl-item { cursor: pointer; border-radius: 6px; }
.tl-item:hover { background: var(--hover-bg); }

/* Per-lead cost ledger */
.cost-box { border: 1px solid var(--color-border-tertiary); border-radius: 8px; padding: 8px; margin-top: 4px; }
.cost-row { display: flex; align-items: center; gap: 8px; padding: 3px 2px; border-bottom: 1px solid var(--color-border-tertiary); font-size: 12px; }
.cost-row:last-of-type { border-bottom: 0; }
.cost-cat { flex: 0 0 96px; color: var(--color-text-secondary); }
.cost-amt { flex: 0 0 78px; font-family: var(--font-mono); text-align: right; }
.cost-note { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-add { display: flex; gap: 5px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.cost-add select, .cost-add input { font-size: 12px; }
.cost-add #cost-amt { width: 84px; }
.cost-add #cost-note { flex: 1; min-width: 90px; }

/* Permanent-delete button (detail head) — danger affordance on hover only, so it reads as
   deliberate. Neutral at rest next to Edit; reddens on hover/focus. Tokens only. */
.lead-del-btn { padding-left: 8px; padding-right: 8px; }
.lead-del-btn:hover, .lead-del-btn:focus-visible {
  color: var(--color-text-danger);
  border-color: color-mix(in srgb, var(--color-text-danger) 45%, transparent);
}
