/* Leads (0225) - the dashboard, one lead, the follow-up list, the lead calendar.
   Tokens only, no hex. The lead table reuses .lead-table / .lt-* from areas/people.css (it was that
   table, moved), and the lead calendar reuses .cal-month / .cm-* / .mi-* from next.css, so a look
   change reaches all of it with no second set of rules.
   ⚠️ No text under 14px anywhere (tools/tests/lib/fontfloor.mjs). */

/* the four numbers at the top, each one a filter */
.lb-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.lb-stat {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  min-width: 108px; padding: 12px 16px; border-radius: 16px; cursor: pointer; text-align: left;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.lb-stat b { font-size: 26px; line-height: 1.1; font-weight: 700; }
.lb-stat span { font-size: 14px; color: var(--ink-2); }
.lb-stat:hover { border-color: var(--text); }
.lb-stat.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.lb-stat.on span { color: var(--on-accent, #fff); }

/* Add a lead: folded shut, full width above the table */
.lb-add { margin: 0 0 18px; }
.lb-add > summary { display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; }
.lb-add > summary::-webkit-details-marker { display: none; }
.lb-add > summary h2 { margin: 0; }
.lb-add > summary .muted { font-size: 14px; }
.lb-add > summary::after { content: '+'; margin-left: auto; font-size: 22px; line-height: 1; color: var(--ink-2); }
.lb-add[open] > summary::after { content: '\2212'; }
.lb-add form { margin: 16px 0 0; }

/* ⚠️ A table in a grid or flex child needs min-width: 0, or the cells widen the column past its
   track and the page scrolls sideways (the same rule the mobile-overflow fixes are about). */
.lt-wrap { min-width: 0; max-width: 100%; overflow-x: auto; }

/* the source picker above the table */
.lt-src { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; }

/* ---- one lead: a header, not a grid of stat tiles ---------------------------------------
   ★ 2026-10-16 (Tovah: "this page looks bad"). It opened with four bordered `.fact` tiles, which
   are the STAT treatment (1.5px border, 22px/800 numbers) - so "Sign call" and "Buyer" read as
   empty text fields, and "Logged 0" was a dead number holding a quarter of the row. */
/* ⚠️ `.actions` is a flex row; the switch inside it keeps its own 20px bottom margin, so the row is
   aligned on the control, not on the box (2026-10-22). */
.lead-back { margin: 0 0 10px; align-items: center; }
.lead-back .lead-tabs { margin-bottom: 0; margin-left: 6px; }
.lead-head { margin: 0 0 26px; display: block; }   /* .page-head is flex; this header stacks */
.lead-head .display { margin: 0; }

/* everything true about them on one line, dot-separated */
.lead-meta { display: flex; flex-wrap: wrap; margin: 10px 0 0; font-size: 16px; color: var(--ink-2); }
.lead-meta span + span::before { content: '·'; margin: 0 8px; opacity: .6; }
.lead-meta span:first-child { font-weight: 700; color: var(--ink); }

/* what they said when they came in: a quote, because it is theirs */
.lead-said {
  margin: 16px 0 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--ink-3);
  font-size: 18px; line-height: 1.5; color: var(--ink);
}
.lead-head .actions { margin-top: 18px; }

/* ---- one lead: ONE thing to do, then things to read -----------------------------------
   ★ 2026-10-19 (Tovah: "the rest of this page is confusing on what you want them to do next").
   "What happened?" is the only card with inputs and it leads; Coming up and History are read. */
/* the cards stack with real air between them, not as bare siblings */
.lead-body { display: flex; flex-direction: column; gap: 28px; }
@media (max-width: 759px) { .lead-body { gap: 18px; } }

.lk-do { border: 1.5px solid var(--ink); }   /* the one card that asks for something */
/* room under the one button on the page */
.lk-do form > .actions { margin-top: 6px; }

/* ⚠️ A ONE-ROW checklist in a card has almost no vertical padding of its own: next.css gives
   `.card .check:first-child` padding-top 4px and `:last-child` padding-bottom 0, which is right for a
   list of eight and wrong for a list of one - the row ends up hard against the heading and the card's
   floor (Tovah, 2026-10-19: "need more padding"). Put it back on the lead rows. */
.lk-next .checklist { margin-top: 10px; }
.card .lead-task { padding: 18px 0; }
.card .lead-task:first-child { padding-top: 12px; }
.card .lead-task:last-child { padding-bottom: 8px; }
.lead-done .lead-task:first-child { padding-top: 8px; }

/* the follow-up chips are radios: the label IS the chip */
.lk-back { border: 0; padding: 0; margin: 0; min-width: 0; }
.lk-back legend { font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.lk-back .chips { margin-bottom: 14px; }
.lk-back .chip { cursor: pointer; }
.lk-back .chip:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
/* ⚠️ The CHOSEN chip is styled by `.chips .chip:has(input:checked)` in areas/people.css - the app
   already has one rule for a radio chip and it paints it ink. Do not add a second one here:
   `:has()` takes the specificity of its argument, so `:has(input:checked)` (0,3,1) outranks
   `:has(:checked)` (0,3,0) and an override written the short way silently loses. An aria-pressed
   BUTTON chip is the accent; a radio chip is ink. Two conventions, both already shipped. */

/* the two endings, as one quiet footer row */
.lk-end { display: flex; flex-wrap: wrap; align-items: end; gap: 18px 36px; padding-top: 34px; padding-bottom: 34px; }
.lk-end form { display: flex; align-items: end; gap: 10px; margin: 0; }
.lk-end .field { min-width: 0; }
.lk-end .field span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.lk-end form:last-child { margin-left: auto; }
@media (max-width: 759px) {
  .lk-end { flex-direction: column; align-items: stretch; }
  .lk-end form, .lk-end form:last-child { margin-left: 0; flex-wrap: wrap; }
  .lk-end .btn { flex: 1 1 auto; justify-content: center; }
}

/* the day / time / minutes row on a lead's Follow up form */
.lk-when { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: end; }
@media (max-width: 759px) { .lk-when { grid-template-columns: 1fr; } }

/* the follow-ups already set, under the form */
.lk-set { margin-top: 6px; padding-top: 10px; border-top: 1.5px solid var(--line); }

/* ---- the follow-up list: bands inside ONE card, hairline rows ---------------------------
   ★ 2026-10-16 (Tovah: "make this page look better"). It was four cards holding one row each, a
   bold "Remove" shouting on every line, and the date stranded at the far right edge. Now it is the
   app's own .check row (next.css), grouped by bands, with the when beside the row and a quiet round
   x that arms into a tick - the same remove the expense rows use. */
.lk-list { padding-top: 6px; padding-bottom: 6px; }
.lk-group + .lk-group { margin-top: 22px; padding-top: 18px; border-top: 1.5px solid var(--line); }
.lk-group .section-t { margin-bottom: 4px; }
.lk-group .h2 { display: flex; align-items: center; gap: 10px; }
/* the count as a circle, like every other number in the app */
.lk-n {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--ground); border: 1px solid var(--line);
  font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.lk-group.is-late .lk-n { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.lk-group.is-now .lk-n { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }

/* one row: tick · what and who · when · remove */
.lead-task { gap: 14px; }
.lead-task .t { min-width: 0; }
.lead-task .lk-w { font-size: 14px; color: var(--ink-2); white-space: nowrap; text-align: right; }
.lead-task .lk-w.late { color: var(--accent); font-weight: 700; }
.lead-task.done .lk-w { opacity: .55; }
/* ⚠️ 40px, not the 46px default: three of these in a list of eight rows is a wall of circles */
.lead-task .lk-x { width: 40px; height: 40px; }
.lead-task .lk-x svg { width: 18px; height: 18px; }
.lead-task .who-tag { text-decoration: none; }
.lead-task .who-tag:hover { color: var(--ink); text-decoration: underline; }

.lead-done { margin-top: 14px; }
.lead-done summary { font-size: 14px; color: var(--ink-2); cursor: pointer; padding: 8px 0; }
.lead-done summary:hover { color: var(--ink); }
.lead-done .checklist { padding: 0 2px 4px; }

/* everything she has logged against a lead */
.lead-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lead-log li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.lead-log li:last-child { border-bottom: 0; }
.lead-log .ll-k {
  font-size: 14px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: var(--ground); border: 1px solid var(--line); white-space: nowrap;
}
.lead-log .ll-x { font-size: 16px; line-height: 1.45; }
.lead-log .ll-w { font-size: 14px; color: var(--ink-2); white-space: nowrap; }

/* a lead as a card: the phone shape, where a six-column table cannot show its own buttons */
.lb-cards { display: flex; flex-direction: column; gap: 12px; }
.lb-card { padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.lb-card .lt-who { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.lb-card .lb-meta { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.lb-card .lb-next { margin: 6px 0 12px; font-size: 16px; }
.lb-card .lb-next span { color: var(--ink-2); }
.lb-card .actions { gap: 8px; flex-wrap: wrap; }

@media (max-width: 759px) {
  .lb-stats { gap: 8px; }
  .lb-stat { min-width: 0; flex: 1 1 46%; padding: 10px 12px; }
  /* the row stays one line on a phone: the when drops under the text rather than squeezing it */
  .lead-task { flex-wrap: wrap; gap: 10px; }
  .lead-task .t { flex: 1 1 60%; }
  .lead-task .lk-w { order: 3; flex: 1 1 100%; text-align: left; padding-left: 42px; }
  .lead-log li { grid-template-columns: 1fr; }
  .lead-log .ll-k { justify-self: start; }
}
