/* Stone Surgeons CRM — the lead page (lead-page.js, Nov 21 2026). Steve's layout: breadcrumb, the name with the
   Lead # | Rep | Paid in | Credit strip, tabs with status pills, Client contact beside Call logs + Appointment history.
   Flat look: the colour tokens come from glass.css (light) and glass-dark.css (dark). Loaded after glass.css. */

#main:has(.detail.lp) { width: 100%; min-width: 0; }   /* the page keeps its width on every tab (main shrinks to fit otherwise) */

/* ── head ── */
.lp-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; font-size: 14px; color: var(--text-2); }
.lp-crumbs a { color: var(--text-2); text-decoration: none; }
.lp-crumbs a:hover { color: var(--primary); text-decoration: underline; }
.lp-crumbs [aria-current] { color: var(--text); font-weight: 500; }
.lp-crumbs .crumb-sep { color: var(--text-3); }
.lp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 12px; }
.lp-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.lp-strip { display: flex; flex-wrap: wrap; align-items: center; padding: 6px 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.lp-strip-i { padding: 2px 12px; white-space: nowrap; }
.lp-strip-i + .lp-strip-i { border-left: 1px solid var(--border-strong); }
.lp-strip .lp-k { color: var(--text-2); }
.lp-strip b { color: var(--text); font-weight: 600; }

/* ── tabs with status pills ── */
.detail.lp { display: block; }
.lp .d-info, .lp .d-ctl, .lp .d-hist, .lp .d-extra { grid-area: auto; }   /* app.css names these areas for the old layout */
.lp-tabs { display: flex; gap: 4px 22px; margin: 0 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.lp-tabs::-webkit-scrollbar { display: none; }
.lp-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-bottom: -1px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--text-2); font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer; }
.lp-tab:hover { color: var(--text); }
.lp-tab.on { color: var(--text); border-bottom-color: var(--primary); }
.lp-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lp-tab-pill:empty { display: none; }
.lp-pill.tone-good { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.lp-pill.tone-wait { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.lp-pill.tone-bad { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

/* ── panes ── */
.lp-pane { min-width: 0; }
.lp-pane[hidden] { display: none; }
.lp-lead { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lp-col, .lp-pane-body, .lp-more { display: grid; gap: 16px; min-width: 0; align-content: start; }
.lp-more .d-trash { display: flex; justify-content: flex-end; }
.lp-card { min-width: 0; }
.lp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.lp-card-head h3 { margin: 0; }

/* Client contact */
.lp-name { margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.lp-name span { display: inline-block; margin-bottom: -1px; padding: 0 0 8px; border-bottom: 2px solid var(--primary); font-weight: 600; }
.lp-contact dl.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.lp-contact .kv-row { min-width: 0; }
.lp-contact .kv-row.wide { grid-column: 1 / -1; }
.lp-contact .kv-row dt { margin: 0; color: var(--text-2); font-size: 13px; font-weight: 400; }
.lp-contact .kv-row dd { margin: 4px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.lp-contact .kv-more { margin-top: 12px; }
.lp-contact .kv-more dl.kv { margin-top: 10px; }
.lp-notes, .lp-sub { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.lp-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.lp-sub-head h4, h4.lp-sub { margin: 0; font-size: 14px; font-weight: 600; }
h4.lp-sub { margin: 16px 0 10px; }
.lp-links { display: flex; gap: 14px; }
.lp-notes ul.notes { margin: 0; }
.lp-notes ul.notes > li { border-bottom: 0; }
.lp-notes.all ul.notes > li + li { border-top: 1px solid var(--border); }
.lp-notes:not(.all) ul.notes > li:nth-child(n+2) { display: none; }
.lp-note-add { display: grid; gap: 8px; margin-top: 10px; }
.lp-note-add[hidden] { display: none; }
.lp-ctl .controls.lp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.lp-ctl .fu { margin-top: 12px; }
.lp-ctl .claim { margin: 0 0 12px; }

/* tables (Call logs, Appointment history, Estimate + Job details) */
.lp-tbl { overflow-x: auto; }
.lp-tbl table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lp-tbl th { padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-weight: 500; text-align: left; white-space: nowrap; }
.lp-tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lp-tbl tbody tr:last-child td { border-bottom: 0; }
.lp-tbl td.empty { padding: 24px 10px; color: var(--text-3); text-align: center; }
.lp-times { display: block; }
.lp-who, .lp-fromto { display: flex; flex-direction: column; }
.lp-fromto { white-space: nowrap; }
.lp-clamp-cell { max-width: 240px; overflow-wrap: anywhere; }
.lp-paid { margin: 0; padding: 10px 12px; border: 1px solid; border-radius: var(--radius); }
.lp-paid.tone-good { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.lp-paid.tone-wait { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }

@media (max-width: 1100px) {
  .lp-lead { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .lp-head { gap: 8px; }
  .lp-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 0; width: 100%; padding: 8px 0; }
  .lp-strip-i { overflow: hidden; text-overflow: ellipsis; }
  .lp-strip-i + .lp-strip-i { border-left: 0; }
  .lp-strip-i:nth-child(2n) { border-left: 1px solid var(--border-strong); }
  .lp-ctl .controls.lp-grid { grid-template-columns: minmax(0, 1fr); }
  .lp-tab { min-height: 44px; }
  .lp-tbl table { min-width: 560px; }
}
