/* platform/public/tables.css
   Shared dashboard table / row-list recipe (Hannah 9/6 standing rule: "all
   tables on the site should look cohesive"). One stylesheet, one set of
   classes, used by every dashboard table and row-list page instead of each
   page carrying its own copy of the same rules.

   Recipe = the Lead Gen batch-rows table (lead-gen.html, the original
   premium pass) plus the two 2026-09-06 premium passes that refined it:
   PR #378 (dashboard.html Websites list -- ~70px rows, no wrapping,
   whole-row hover on the --w-surface-hover token, the .status-cell
   border-radius fix) and PR #377 (search.html/campaigns.html results table
   -- pill links for URL cells, dot+text statuses, sticky header/columns).

   Two-color rule: --w-accent (indigo) + --w-accent-2 (warm amber) only.
   Status is always a dot + text label, never a colored pill background.
   Failed/off stays quiet gray (--w-dot-off), never red.

   Load order: link this AFTER theme.css/skin.css and BEFORE each page's own
   <style> block. Every selector below is wrapped in :where(...), which
   matches normally but contributes ZERO specificity -- so a page's own
   single-class override (e.g. dashboard.html's `.actions-cell { width:
   2.6rem; padding-left: 0.4rem; ... }`) always wins on specificity, and even
   a same-zero-specificity page rule wins by simply loading later in the
   cascade. Without :where(), a shared rule like `.w-table td { padding:
   0.9rem 1.4rem }` (specificity 0,1,1) would out-rank a page's plain
   `.actions-cell { padding-left: 0.4rem }` (0,1,0) and silently blow out
   that column's width -- caught during this file's own regression check
   (table-cohesion 2026-09-07) via a before/after pixel diff of dashboard.html
   that showed the Actions column 20px too wide before this fix. Page rules
   (a denser font-size on the wide 28-column results table, sticky-left
   columns, campaign column widths #375/#376) stay page-scoped on purpose;
   this file only carries the shared mechanism: row height, dividers, hover,
   cell fonts, status dot+text, pill links, sticky header. */

:where(.w-table) { width: 100%; border-collapse: collapse; }

:where(.w-table) :where(thead th) {
  text-align: left; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--w-muted); padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--w-border);
}

:where(.w-table) :where(td, tbody td) {
  padding: 0.9rem 1.4rem; border-bottom: 1px solid var(--w-border);
  font-size: 0.88rem; color: var(--w-body); vertical-align: middle;
}
:where(.w-table) :where(tbody tr:last-child td) { border-bottom: none; }

/* Whole-row hover, flat -- no border-radius/transform/animation on the row
   OR on any single cell (PR #378's fix for the "rounded lavender blob" bug:
   a per-cell radius clips a border-collapse table's row-hover background
   into a stadium shape). Rows opt in with either `.is-clickable` or a
   `data-href` attribute (dashboard.js's convention for whole-row navigation),
   or the page-specific `.batch-row` class lead-gen.js already emits. */
:where(.w-table) :where(tbody tr.is-clickable, tbody tr[data-href], tbody tr.batch-row) {
  cursor: pointer; transition: background 120ms;
}
:where(.w-table) :where(tbody tr.is-clickable:hover, tbody tr[data-href]:hover, tbody tr.batch-row:hover) {
  background: var(--w-surface-hover);
}

/* Bold primary line (a name/id) + a muted one-line secondary underneath.
   `.cell-sub` is kept as an alias -- lead-gen.js/lead-gen-batch.js already
   emit that exact class name and this file's rule is a byte-for-byte match,
   so no JS rename was needed to adopt it. */
:where(.w-table) :where(.cell-primary) { font-weight: 600; color: var(--w-ink); }
:where(.w-table) :where(.cell-secondary, .cell-sub) {
  display: block; font-size: 0.78rem; font-weight: 400; color: var(--w-muted); margin-top: 0.15rem;
}

/* Dot + text status -- never a filled pill background (two-color rule).
   Variant classes below reuse the existing --w-dot-* tokens (theme.css);
   the bare `.dot-live`/`.dot-busy`/`.dot-failed`/`.dot-archived` names are
   kept as aliases so pages that already emit that markup (dashboard.js,
   lead-gen.html) don't need a JS rename to adopt this file. */
:where(.w-table) :where(.status, .status-pill) {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.85rem;
  font-weight: 600; text-transform: capitalize; color: var(--w-ink); white-space: nowrap;
}
:where(.w-table) :where(.status-dot) { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
:where(.w-table) :where(.status-dot.live, .status-dot.dot-live) { background: var(--w-dot-live); }
:where(.w-table) :where(.status-dot.busy, .status-dot.dot-busy) {
  background: var(--w-dot-busy); animation: w-table-dot-pulse 1.6s ease-in-out infinite;
}
:where(.w-table) :where(.status-dot.off, .status-dot.failed, .status-dot.dot-failed, .status-dot.dot-archived) {
  background: var(--w-dot-off);
}
@keyframes w-table-dot-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* Small outlined pill link for a URL-type cell (Website/GBP/Logo/Socials,
   #377's recipe). */
:where(.w-table) :where(.pill-link) {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; font-weight: 600;
  padding: 0.28rem 0.65rem; border-radius: 999px; border: 1px solid var(--w-border);
  background: var(--w-bg); color: var(--w-body); text-decoration: none; white-space: nowrap;
}
:where(.w-table) :where(.pill-link:hover) { background: var(--w-accent-soft); color: var(--w-accent); border-color: var(--w-accent); }

/* Sticky header for a table that scrolls its own body. */
:where(.w-table--sticky) :where(thead th) { position: sticky; top: 0; background: var(--w-surface); z-index: 2; }

/* ---------- .w-rows: same recipe for a flex row-list that isn't a <table>
   (e.g. Settings credits rows, site.html credential/agent-token rows). ---------- */
:where(.w-rows) { display: flex; flex-direction: column; }
:where(.w-rows) :where(.w-row) {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.9rem 1.4rem; border-bottom: 1px solid var(--w-border); font-size: 0.88rem; color: var(--w-body);
}
:where(.w-rows) :where(.w-row:last-child) { border-bottom: none; }
:where(.w-rows) :where(.w-row.is-clickable) { cursor: pointer; transition: background 120ms; }
:where(.w-rows) :where(.w-row.is-clickable:hover) { background: var(--w-surface-hover); }

/* ---------- Website Report card (lead-detail drawer, moved here from
   search.html/campaigns.html's per-page copy 2026-09-08 -- table-cohesion
   round 2b, brief-website-report-card.md). The label/value pair inside a
   .w-row: label reuses each page's own .detail-label, value gets a dot+text
   .status-value on the right. Two-color rule -- amber dot only, and only on
   a row that needs attention; a row that's fine or a neutral fact carries no
   dot at all (a gray dot on a good row used to read as disabled). ---------- */
:where(.w-rows) :where(.status-value) {
  font-weight: 600; color: var(--w-body); display: inline-flex; align-items: center; gap: 0.45rem;
}
:where(.w-rows) :where(.status-dot) { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
:where(.w-rows) :where(.status-dot-amber) { background: var(--w-accent-2); }

/* Website Report section-header summary ("1 issue"/"2 issues") -- plain
   dot + text, no border or pill background (every other dot+text status on
   the dashboard is unstyled like this; the old bordered pill was the odd
   one out, per Hannah's 9/8 flag). No dot at all when there are 0 issues. */
:where(.wr-summary) {
  display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; color: var(--w-body);
}
:where(.wr-summary.is-quiet) { color: var(--w-muted); font-weight: 600; }
:where(.wr-summary) :where(.status-dot) { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
:where(.wr-summary) :where(.status-dot-amber) { background: var(--w-accent-2); }

/* Bottom issue-line block under the rows: one quiet list, small muted text,
   amber dot per line, no card-in-card background/border. */
:where(.drawer-issue-pills) { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.7rem; }
:where(.drawer-issue-line) {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--w-muted);
}
:where(.drawer-issue-line) :where(.status-dot) { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
:where(.drawer-issue-line) :where(.status-dot-amber) { background: var(--w-accent-2); }

/* Any URL value shown as text in the lead-detail drawer (GBP URL, Logo URL,
   etc.) -- accent-colored link, underline only on hover, breaks inside the
   row instead of overflowing on a long URL. Hannah 9/8: "make sure any
   links on our dashboard are actually clickable." */
:where(.drawer-url-link) { color: var(--w-accent); text-decoration: none; word-break: break-all; }
:where(.drawer-url-link:hover) { text-decoration: underline; }

/* "Share report" block at the foot of the drawer's Website Report section
   (2026-10-01, website-report-share.js). Buttons reuse each page's
   .drawer-action-btn pill; the inputs take the same border/radius/font so the
   row reads as one control. No new colors: body, muted, border, accent. */
:where(.wr-share) { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--w-border); }
:where(.wr-share-label) { display: block; font-size: 0.78rem; color: var(--w-muted); margin-bottom: 0.4rem; }
:where(.wr-share-result) { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
:where(.wr-share-url) {
  flex: 1 1 14rem; min-width: 0; border: 1px solid var(--w-border); border-radius: 12px; padding: 0.55rem 0.8rem;
  font: 500 13px/1.2 var(--w-font); color: var(--w-body); background: var(--w-bg);
}
:where(.wr-share-url):focus { outline: none; border-color: var(--w-accent); }
:where(.wr-share) :where(button.drawer-action-btn) { cursor: pointer; }
:where(.wr-share) :where(button.drawer-action-btn:disabled) { opacity: 0.5; cursor: progress; }
:where(.wr-share-out) { margin-top: 0.4rem; }
:where(.wr-share-error), :where(.wr-share-note) { margin: 0; font-size: 0.82rem; color: var(--w-muted); }

/* "Send price tool" block under the report link (2026-11-06,
   price-tool-demo-share.js): the picker takes the link box's border, radius
   and font; the status chip is the same muted note text. No new colors. */
:where(.pt-demo-select) {
  flex: 1 1 12rem; min-width: 0; border: 1px solid var(--w-border); border-radius: 12px; padding: 0.55rem 0.8rem;
  font: 500 13px/1.2 var(--w-font); color: var(--w-body); background: var(--w-bg);
}
:where(.pt-demo-select):focus { outline: none; border-color: var(--w-accent); }
:where(.pt-demo-status) { flex: 1 1 100%; margin: 0; font-size: 0.82rem; color: var(--w-muted); }

/* "Edit report" panel under the link (2026-10-27): same tokens as the box. */
:where(.wr-edit) { margin-top: 0.75rem; padding: 0.9rem; border: 1px solid var(--w-border); border-radius: 12px;
  display: grid; gap: 0.75rem; }
:where(.wr-edit-field) { display: grid; gap: 0.3rem; }
:where(.wr-edit-label) { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--w-ink); }
:where(.wr-edit-help) { margin: 0; font-size: 0.78rem; color: var(--w-muted); }
:where(.wr-edit-input) { width: 100%; box-sizing: border-box; border: 1px solid var(--w-border); border-radius: 8px;
  padding: 0.55rem 0.7rem; font: 400 13px/1.4 var(--w-font); color: var(--w-ink); background: var(--w-bg); }
:where(.wr-edit-input):focus { outline: none; border-color: var(--w-accent); }
:where(.wr-edit-note) { resize: vertical; }
:where(.wr-edit-findings) { display: grid; gap: 0.6rem; }
:where(.wr-edit-area) { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--w-muted); }
:where(.wr-edit-areahead) { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
:where(.wr-edit-areatoggle) { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--w-body); cursor: pointer; }
:where(.wr-edit-areatoggle input) { width: 14px; height: 14px; margin: 0; accent-color: var(--w-accent); }
:where(.wr-edit-group.is-hidden .wr-edit-row) { opacity: 0.45; }
:where(.wr-edit-row) { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-top: 1px solid var(--w-border); }
:where(.wr-edit-line) { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem;
  color: var(--w-ink); cursor: pointer; }
:where(.wr-edit-line input) { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--w-accent); }
:where(.wr-edit-row.is-good .wr-edit-line) { color: var(--w-body); }
:where(.wr-edit-pin) { flex: none; min-width: 4.5rem; height: 32px; border: 1px solid var(--w-border); border-radius: 8px;
  background: var(--w-bg); font: 600 12px/1 var(--w-font); color: var(--w-body); cursor: pointer; }
:where(.wr-edit-pin[aria-pressed="true"]) { border-color: var(--w-accent); color: var(--w-accent); background: var(--w-accent-soft); }
:where(.wr-edit-pin:disabled) { opacity: 0.4; cursor: default; }
:where(.wr-edit-save) { justify-self: start; }
:where(.wr-edit-status) { margin: 0; font-size: 0.82rem; color: var(--w-body); min-height: 1.2em; }

/* Verified-owner check mark (2026-10-12): results table OWNER cell and the
   lead drawer's Owner row (leadgen-results.js verifiedMarkHtml). Accent
   token only -- no new colours. */
.rt-verified { color: var(--w-accent); font-weight: 700; font-size: 0.8em; margin-left: 0.3rem; }


/* Report wrong owner (14 Nov 2026, leadgen-results.js ownerReportHtml): a
   small grey question mark beside the owner card's "Owner" heading; pointing
   at it (or tapping it: owner-report.js toggles .is-open) shows a short note
   with the "Report wrong owner" link. A muted "Reported" once sent, and the
   confirm box. Theme tokens only. */
.owner-report-help { position: relative; display: inline-block; margin-left: 6px; vertical-align: 1px;
  text-transform: none; letter-spacing: normal; font-weight: 400; }
.owner-report-q { width: 16px; height: 16px; padding: 0; border: 1px solid var(--w-border); border-radius: 50%;
  background: transparent; color: var(--w-muted); font: 600 10px/14px var(--w-font); cursor: help; }
.owner-report-q:hover, .owner-report-q:focus-visible, .owner-report-help.is-open .owner-report-q { color: var(--w-ink); border-color: var(--w-muted); }
.owner-report-tip { position: absolute; left: -8px; top: calc(100% + 6px); z-index: 30; width: 250px; padding: 10px 12px;
  background: var(--w-surface); border: 1px solid var(--w-border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 18, 34, 0.12); color: var(--w-ink); font-size: 13px; line-height: 1.45;
  visibility: hidden; opacity: 0; transition: opacity .12s ease; }
.owner-report-tip::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.owner-report-help:hover .owner-report-tip, .owner-report-help:focus-within .owner-report-tip,
.owner-report-help.is-open .owner-report-tip { visibility: visible; opacity: 1; }
.owner-report-link { display: inline; padding: 0; border: 0; background: none; font: inherit; font-weight: 600;
  color: var(--w-accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.owner-reported { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: var(--w-surface-hover);
  color: var(--w-muted); font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: normal; vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) { .owner-report-tip { transition: none; } }
.owner-report-backdrop { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 18, 34, 0.38); }
.owner-report-box { width: 420px; max-width: 100%; box-sizing: border-box; padding: 20px; display: flex; flex-direction: column;
  gap: 10px; background: var(--w-surface); border: 1px solid var(--w-border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 18, 34, 0.16); color: var(--w-body, var(--w-ink)); font-size: 14px; line-height: 1.5; }
.owner-report-box h2 { margin: 0; font: 600 16px/1.3 var(--w-font); color: var(--w-ink); }
.owner-report-box p { margin: 0; }
.owner-report-note { color: var(--w-muted); font-size: 13px; }
.owner-report-msg { padding: 10px 12px; border-radius: 8px; background: var(--w-accent-soft); color: var(--w-ink); font-weight: 600; }
.owner-report-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.owner-report-actions .w-btn { width: auto; padding: 9px 14px; }
