/* Lighthouse v1 · Landing pages tab (assets/js/lighthouse-pages.js, contract §10).
   Every rule is scoped under .lh-pages-root (the module's own wrapper inside the tab); no global rules.
   Colours and fonts come from the page's --lh-* tokens (lighthouse.css), with the same values as fallbacks.
   Controls, chips, tables, notes and the tooltip reuse the page's own classes (lh-btn, lh-select, lh-search,
   lh-fchip, lh-lead-table, lh-nc, lh-tooltip …), so the tab matches the rest of Lighthouse; only layout lives here.
   Light theme only, like the page. Neutral colours; nothing here is red. */
.lh-pages-root {
  display: flex; flex-direction: column; gap: 24px; min-width: 0;
  color: var(--lh-ink, #1e2a4a);
  font: 400 14px/20px var(--lh-f-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif);
}
.lh-pages-root, .lh-pages-root *, .lh-pages-root *::before, .lh-pages-root *::after { box-sizing: border-box; }
.lh-pages-root [hidden] { display: none !important; }
.lh-pages-root .lp-card { min-width: 0; }
.lh-pages-root .lp-sub { margin: 4px 0 0; color: var(--lh-ink-muted, #4f5b76); font-size: 14px; line-height: 20px; max-width: 90ch; }

/* ---------- controls ---------- */
.lh-pages-root .lp-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 12px; min-width: 0; }
.lh-pages-root .lp-search { flex: 1 1 280px; }
.lh-pages-root .lp-field { display: inline-flex; gap: 8px; align-items: center; min-width: 0; max-width: 100%; }
.lh-pages-root .lp-field > .lh-caps { flex: none; white-space: nowrap; overflow-wrap: normal; }
.lh-pages-root .lp-summary { margin: 0 0 12px; font-size: 12px; line-height: 16px; color: var(--lh-ink-muted, #4f5b76); font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 32px; margin: 0 0 12px; font-size: 14px; line-height: 20px; }
.lh-pages-root .lp-selbar .lh-focus-actions { display: flex; gap: 12px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.lh-pages-root .lp-chips { list-style: none; margin: 0; padding: 0; min-width: 0; flex: 1 1 auto; }
.lh-pages-root .lp-chips > li { list-style: none; margin: 0; }
.lh-pages-root .lp-chips > li::before, .lh-pages-root .lp-chips > li::marker { content: none; }
.lh-pages-root .lp-fchip { max-width: 320px; }
.lh-pages-root .lp-body { min-width: 0; }
.lh-pages-root .lp-body[aria-busy="true"] { opacity: .6; transition: opacity 150ms; }
.lh-pages-root .lp-loading { margin: 8px 0; font-size: 13px; }
.lh-pages-root .lp-actions { margin-top: 12px; }
.lh-pages-root .lp-more { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.lh-pages-root .lp-note { margin-top: 12px; font-size: 12px; line-height: 16px; color: var(--lh-ink-faint, #5f6b85); max-width: 110ch; }
.lh-pages-root .lp-split-legend { margin: 0 0 8px; align-items: center; }

/* ---------- identity: the page's number badge and line swatch ---------- */
.lh-pages-root .lp-num {
  display: inline-grid; place-items: center; flex: none; min-width: 18px; height: 18px; padding: 0 4px; margin-right: 6px;
  border: 1px solid var(--lh-ink, #1e2a4a); border-radius: 9px; background: var(--lh-card, #ffffff); color: var(--lh-ink, #1e2a4a);
  font: 600 11px/16px var(--lh-f-sans, sans-serif); font-variant-numeric: tabular-nums; vertical-align: 1px;
}
.lh-pages-root .lp-fchip .lp-num { margin-right: 0; }
.lh-pages-root .lp-sw { display: inline-block; flex: none; width: 22px; height: 10px; vertical-align: 0; }

/* ---------- pages table ---------- */
/* position: relative keeps the absolutely positioned .lh-vh texts inside the scroll box (else they widen the page on phones) */
.lh-pages-root .lp-scroll { min-width: 0; position: relative; }
.lh-pages-root .lp-check { cursor: pointer; width: 16px; height: 16px; vertical-align: middle; accent-color: var(--lh-selected-bg, #0f1b3d); }
.lh-pages-root .lp-check:disabled { cursor: not-allowed; }
.lh-pages-root .lp-picked { box-shadow: inset 3px 0 0 var(--lh-ink, #1e2a4a); }
.lh-pages-root .lp-spark { display: block; overflow: visible; }
.lh-pages-root .lp-spark-line { fill: none; stroke: var(--lh-line, #4b5263); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.lh-pages-root .lp-spark-area { fill: var(--lh-band, #e9edf4); stroke: none; }
.lh-pages-root .lp-spark-dot { fill: var(--lh-line, #4b5263); }
.lh-pages-root .lp-split { display: block; width: auto; min-width: 104px; }
.lh-pages-root .lp-split-bar { width: 104px; }
.lh-pages-root .lp-split-cap { display: block; margin-top: 2px; font-size: 11px; line-height: 14px; color: var(--lh-ink-faint, #5f6b85); white-space: nowrap; }
/* R-2: the Calls / Forms / Chat … counts, visible without hover; the column is at least 180 px and the line wraps */
.lh-pages-root .lp-split-n { display: block; margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--lh-ink-muted, #4f5b76); white-space: normal; font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-td-split, .lh-pages-root .lp-th-split,
#wlf-lighthouse .lh-pages-root .lh-lead-table td.lp-td-split, #wlf-lighthouse .lh-pages-root .lh-lead-table th.lp-th-split { min-width: 180px; white-space: normal; }
/* K-14: every sortable header is a button; the arrow shows the active sort */
.lh-pages-root .lp-sort, #wlf-lighthouse .lh-pages-root .lp-sort { margin: 0; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit;
  letter-spacing: inherit; text-transform: inherit; text-align: inherit; white-space: inherit; line-height: inherit; border-radius: 4px; }
/* the pages table's headers may wrap (long outcome labels such as "Turned down (from Sep 29)") */
.lh-pages-root .lp-pages th, #wlf-lighthouse .lh-pages-root .lh-lead-table.lp-pages th { white-space: normal; overflow-wrap: normal; word-break: normal; hyphens: none; vertical-align: bottom; }
.lh-pages-root .lp-sort:hover { color: var(--lh-ink, #1e2a4a); text-decoration: underline; text-underline-offset: 3px; }
.lh-pages-root .lp-sort:focus-visible { outline: 2px solid var(--lh-focus, #2f6fdb); outline-offset: 2px; }
.lh-pages-root .lp-sort-on { color: var(--lh-ink, #1e2a4a); }
.lh-pages-root .lp-sort-on::after { content: " \2193"; }
.lh-pages-root th[aria-sort="ascending"] .lp-sort-on::after { content: " \2191"; }
.lh-pages-root .lp-dcell { font-variant-numeric: tabular-nums; }

/* ---------- selected pages: line chart ---------- */
.lh-pages-root .lp-chart-wrap { position: relative; min-width: 0; }
.lh-pages-root .lp-chart { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; }
.lh-pages-root .lp-chart:focus-visible { outline: 2px solid var(--lh-focus, #2f6fdb); outline-offset: 2px; }
.lh-pages-root .lp-chart text { fill: var(--lh-ink-faint, #5f6b85); font: 400 12px var(--lh-f-cond, sans-serif); font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-gridline { stroke: var(--lh-grid, #edf0f5); stroke-width: 1; }
.lh-pages-root .lp-base { stroke: var(--lh-control-border, #8a93a9); stroke-width: 1; }
.lh-pages-root .lp-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lh-pages-root .lp-dot { stroke: var(--lh-card, #ffffff); stroke-width: 2; }
.lh-pages-root .lp-series { transition: opacity 150ms; }
.lh-pages-root .lp-chart.lp-hl .lp-series { opacity: .18; }
.lh-pages-root .lp-chart.lp-hl .lp-series.lp-on { opacity: 1; }
.lh-pages-root .lp-chart.lp-hl .lp-series.lp-on .lp-line { stroke-width: 3; }
.lh-pages-root .lp-cross { stroke: var(--lh-ink-faint, #5f6b85); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.lh-pages-root .lp-mark { stroke: var(--lh-card, #ffffff); stroke-width: 2; pointer-events: none; }
.lh-pages-root .lp-hit { fill: transparent; cursor: crosshair; }
.lh-pages-root .lp-legend { margin-top: 12px; gap: 6px 16px; }
.lh-pages-root .lp-leg { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; max-width: 100%; text-align: left; font-size: 12px; line-height: 18px; }
.lh-pages-root .lp-leg > .lp-sw { margin-top: 4px; }
.lh-pages-root .lp-leg .lp-num { margin-right: 0; }
.lh-pages-root .lp-leg-txt { display: flex; flex-direction: column; min-width: 0; }
/* R-1: the whole label, wrapped (no ellipsis) */
.lh-pages-root .lp-leg-lab { min-width: 0; max-width: 60ch; white-space: normal; overflow-wrap: anywhere; color: var(--lh-ink, #1e2a4a); }
/* R-2: each selected page's mix under its label */
.lh-pages-root .lp-leg-mix { display: block; color: var(--lh-ink-muted, #4f5b76); font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-prior-th, .lh-pages-root .lp-prior { color: var(--lh-ink-faint, #5f6b85); }
.lh-pages-root .lp-leg[aria-pressed="true"] .lp-leg-lab { text-decoration: underline; text-underline-offset: 3px; }
.lh-pages-root .lp-daytable { font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-dayth { font-weight: 500; white-space: nowrap; text-align: left; padding: 6px 8px; }
.lh-pages-root .lp-daytable .lp-num { margin-right: 0; }

/* tooltip: the page's .lh-tooltip look; these are the same values for use outside #wlf-lighthouse */
.lh-pages-root .lp-tip { position: fixed; z-index: 99990; pointer-events: none; background: var(--lh-card, #ffffff); color: var(--lh-ink, #1e2a4a);
  border: 1px solid var(--lh-border, #e3e7ef); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 18px; max-width: 320px;
  box-shadow: var(--lh-shadow, 0 4px 16px rgba(15, 27, 61, .12)); font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-tip strong { display: block; font-weight: 600; margin-bottom: 2px; }
/* R-1: the popup shows whole URLs. The shell's "#wlf-lighthouse .lh-tooltip { max-width: 280px }" outranks a plain
   .lh-pages-root rule, so the width rule carries the id too; long lines wrap instead of ending in an ellipsis. */
.lh-pages-root .lp-tip, #wlf-lighthouse .lh-pages-root .lp-tip { max-width: min(560px, calc(100vw - 16px)); }
.lh-pages-root .lp-tip-line { white-space: normal; overflow-wrap: anywhere; overflow: visible; text-overflow: clip; }

/* ---------- summary, notes, SHOWING fallback, export ---------- */
.lh-pages-root .lp-sumwrap { margin: 0 0 12px; }
.lh-pages-root .lp-sumline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.lh-pages-root .lp-sumline .lp-summary { margin: 0; }
.lh-pages-root .lp-basis, .lh-pages-root .lp-delta { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--lh-ink-faint, #5f6b85); font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-cmp-note { margin: 4px 0 0; font-size: 12px; line-height: 16px; }
/* W-06: a visible note, not only a title */
.lh-pages-root .lp-outnote { margin: 0 0 8px; font-size: 13px; line-height: 18px; color: var(--lh-ink-muted, #4f5b76); }
.lh-pages-root .lp-preview-note { margin: 0 0 8px; font-size: 12px; line-height: 16px; }
.lh-pages-root .lp-localshow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.lh-pages-root .lp-exp:empty { display: none; }

/* ---------- leads list ---------- */
.lh-pages-root .lp-msg { font-size: 13px; line-height: 18px; color: var(--lh-ink-muted, #4f5b76); }
.lh-pages-root .lp-msg.lp-msg-on { margin: 0 0 12px; padding: 0; border-radius: 0; background: none; color: var(--lh-ink-muted, #4f5b76); }
.lh-pages-root .lp-time { font-variant-numeric: tabular-nums; }
.lh-pages-root .lp-sf { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid transparent; text-decoration: none; font-size: 14px; line-height: 1; }
.lh-pages-root .lp-sf:hover { border-color: var(--lh-control-border, #6b7590); background: var(--lh-hover-bg, #eef1f6); }

/* ---------- responsive ---------- */
@media (max-width: 899px) {
  .lh-pages-root { gap: 16px; }
}
@media (max-width: 599px) {
  .lh-pages-root .lp-controls { gap: 8px; }
  .lh-pages-root .lp-search { flex-basis: 100%; }
  .lh-pages-root .lp-field { flex: 1 1 140px; }
  .lh-pages-root .lp-field .lh-select { flex: 1 1 auto; min-width: 0; width: 100%; }
  .lh-pages-root .lp-fchip { max-width: 100%; }
  .lh-pages-root .lp-leg-lab { max-width: 100%; }
}
/* K-13: print (only when the shell turns printing on, spec §1.8: :root[data-lh-print]) */
@media print {
  :root[data-lh-print] .lh-pages-root .lp-controls, :root[data-lh-print] .lh-pages-root .lp-selbar,
  :root[data-lh-print] .lh-pages-root .lp-td-check, :root[data-lh-print] .lh-pages-root .lp-pages th:first-child,
  :root[data-lh-print] .lh-pages-root .lh-btn, :root[data-lh-print] .lh-pages-root .lp-exp, :root[data-lh-print] .lh-pages-root .lp-more,
  :root[data-lh-print] .lh-pages-root .lp-tip, :root[data-lh-print] .lh-pages-root .lp-localshow, :root[data-lh-print] .lh-pages-root .lp-info-slot,
  :root[data-lh-print] .lh-pages-root .lp-leads td:last-child, :root[data-lh-print] .lh-pages-root .lp-leads th:last-child { display: none !important; }
  :root[data-lh-print] .lh-pages-root tbody tr:nth-child(n+26) { display: none !important; }
  :root[data-lh-print] .lh-pages-root .lp-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
  :root[data-lh-print] .lh-pages-root .lp-scroll { overflow: visible !important; }
  :root[data-lh-print] .lh-pages-root .lp-sort { text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lh-pages-root *, .lh-pages-root *::before, .lh-pages-root *::after { transition: none !important; animation: none !important; }
}
