/* Connect CRM - the CRM's own parts, over apps/shared/app.css and apps/shared/kit.css
   (BUSINESS-PLATFORM-CONTRACT.md 8, F1).

   What any screen shares - evidence words, section errors, list summaries, filter bars, tabs, the
   section nav, views, smart filters, the selection tick and bar, tags, the wizard, figures and
   charts, the table in its own scroller - is the screen kit's (kit.css, `pa-*`); since 2026-10-22
   this file holds only what is the CRM's alone. Colour only from the theme tokens (--cx-*) and the
   app's names (--pa-*), so Day and Dark both come from connect-theme.css; no !important, no @layer.
   Every class here is `cr-` and scoped to the CRM, but for the two CRM-only adjustments of shared
   classes just below. */

/* ---- shared classes, as the CRM draws them ------------------------------------------------ */
button.pa-link-btn { border: 0; background: transparent; font: inherit; font-size: var(--cx-text-small); cursor: pointer; padding: 0 4px; }
/* Controls inside a row sit above the row's full-row link (.pa-row-link::after). */
.pa-row .pa-btn, .pa-row button, .pa-row a:not(.pa-row-link) { position: relative; z-index: 1; }

/* ---- contacts: the selected row ------------------------------------------------------------- */
@media (hover: hover) { .cr-contacts tr:hover .pa-pick .pa-avatar { box-shadow: 0 0 0 2px var(--cx-border-strong); } }
.cr-contacts tr.is-picked { background: var(--cx-selected); }

/* ---- saved views, quick add, columns and inline edit (CRM Plus Global 5.6, screens/core/views.js) -- */
.cr-saved-slot { display: contents; }
/* The saved-views group keeps its size and the filter row wraps (2026-10-30): shrinking, it pushed Save View into the
   search field beside it. Inside it the view picker is what gives way. */
.cr-saved { display: flex; flex: 0 0 auto; max-width: 100%; flex-wrap: nowrap; align-items: flex-end; gap: var(--pa-s2); min-width: 0; }
.cr-saved:has(.pa-help) { flex-wrap: wrap; }
.cr-saved-pick { flex: 0 1 220px; min-width: 0; }
.cr-saved-pick .pa-select { min-width: 0; width: 100%; }
.cr-saved-actions { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: var(--pa-s2); }
.cr-saved .pa-help { flex-basis: 100%; margin: 0; }
.cr-sum-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--pa-s2); }
.cr-sum-bar p { margin: 0; }
.cr-cell-edit { max-width: 100%; }
.cr-cell-link { display: inline-flex; align-items: center; min-height: 24px; max-width: 100%; overflow-wrap: anywhere; }
@media (any-pointer: coarse) { .cr-cell-link { min-height: var(--pa-ctl); } }   /* a cell's own link is its own tap target (44 px) */
.cr-cell-link[href^="tel:"] { white-space: nowrap; }   /* a phone number is read whole, never split across lines */
.cr-quick { padding: var(--pa-s2) var(--pa-s4); border-bottom: 1px solid var(--cx-border-soft); }
.cr-quick > summary { min-height: var(--pa-tap); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: var(--cx-text-small); }
.cr-quick[open] { padding-bottom: var(--pa-s4); }
.cr-quick-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--pa-s3); align-items: end; margin-top: var(--pa-s3); }
.cr-quick-go { display: flex; }
.cr-quick-said, .cr-quick-help { grid-column: 1 / -1; margin: 0; }
.cr-quick-said:empty { display: none; }

/* ---- the contact 360 --------------------------------------------------------------------- */
.cr-ident { display: flex; align-items: center; gap: var(--pa-s2); margin: 0 0 var(--pa-s4); overflow-wrap: anywhere; }
.cr-c360-business { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pa-s2); margin: calc(-1 * var(--pa-s2)) 0 var(--pa-s4); }
.cr-c360-business .pa-select { max-width: 100%; }
/* A business's own panels wait, hidden, until a business is chosen (the panel kit sets display, so say it here). */
.cr-biz-panel[hidden] { display: none; }
.cr-signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--pa-s3) var(--pa-s5); align-items: start; }
.cr-signal-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cr-signal-main strong { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cr-signal-main .pa-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cr-signal-facts { grid-column: 1 / -1; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: var(--pa-s3) var(--pa-s4); }
.cr-fact { display: grid; gap: 2px; min-width: 0; }
.cr-fact dt { color: var(--cx-text-3); font-size: var(--cx-text-meta); }
.cr-fact dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cr-reasons { margin-top: var(--pa-s3); }
.cr-reasons > summary, .cr-facts > summary, .cr-paste > summary, .cr-table-view > summary { min-height: var(--pa-tap); display: inline-flex; align-items: center; cursor: pointer; font-weight: 600; font-size: var(--cx-text-small); color: var(--cx-text-2); }
.cr-reason-list { list-style: none; margin: var(--pa-s2) 0 0; padding: 0; display: grid; gap: 6px; }
.cr-reason-list li { display: grid; grid-template-columns: 3.5em minmax(0, 1fr) auto; align-items: center; gap: var(--pa-s2); font-size: var(--cx-text-small); }
.cr-points { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--cx-success-text); }
.cr-points.is-neg { color: var(--cx-danger-text); }
.cr-reason-text { min-width: 0; overflow-wrap: anywhere; }
.cr-timeline > li[data-evidence="inferred"] .pa-tl-title { font-style: italic; }
.cr-timeline .pa-tl-head { flex-wrap: wrap; }
.cr-timeline .pa-tl-title a { color: inherit; }
.cr-fields { margin: 0; display: grid; gap: var(--pa-s3); }
.cr-field { display: grid; gap: 2px; min-width: 0; }
.cr-field dt { color: var(--cx-text-3); font-size: var(--cx-text-meta); font-weight: 600; }
.cr-field dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.cr-field-value { font-weight: 600; overflow-wrap: anywhere; }
.cr-field-src { flex-basis: 100%; }
.cr-inline-edit { display: grid; gap: var(--pa-s2); flex-basis: 100%; min-width: 0; }
.cr-inline-edit .pa-field { margin: 0; }
.cr-empty-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--pa-s3); }
.cr-suggestions { border-color: var(--cx-warning); }
.cr-quote { margin: 4px 0 0; padding-left: var(--pa-s3); border-left: 2px solid var(--cx-border-strong); color: var(--cx-text-2); font-size: var(--cx-text-small); overflow-wrap: anywhere; }
.cr-draft { display: grid; gap: var(--pa-s3); }
.cr-draft-text { min-height: 240px; font-family: inherit; }
.cr-facts ul { margin: var(--pa-s2) 0 0; padding-left: var(--pa-s5); font-size: var(--cx-text-small); color: var(--cx-text-2); }

/* ---- tasks, occasions, quality, import ---------------------------------------------------- */
.cr-task.is-done .pa-row-title { color: var(--cx-text-3); text-decoration: line-through; }
.cr-overdue { color: var(--cx-danger-text); font-weight: 600; }
.cr-task .pa-row-side { flex-wrap: wrap; justify-content: flex-end; }
.cr-occ-date { flex: none; width: 7.5em; font-weight: 600; font-size: var(--cx-text-small); font-variant-numeric: tabular-nums; }
.cr-occ-date[data-soon] { color: var(--pa-accent-text); }
.cr-checks, .cr-dups { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--pa-s2); }
.cr-check { display: flex; align-items: center; gap: var(--pa-s3); padding: var(--pa-s3); border: 1px solid var(--cx-border-soft); border-radius: var(--cx-radius-sm); }
.cr-check.is-warn { border-left: 3px solid var(--cx-warning); }
.cr-check.is-info { border-left: 3px solid var(--cx-info); }
.cr-check-n { flex: none; min-width: 3ch; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.cr-check .pa-row-side { margin-left: auto; display: flex; align-items: center; gap: var(--pa-s2); }
.cr-dup { padding: var(--pa-s3); border: 1px solid var(--cx-border-soft); border-radius: var(--cx-radius-sm); }
.cr-dup-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--pa-s3); }
.cr-dup-card { position: relative; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: var(--pa-s3); border-radius: var(--cx-radius-sm); background: var(--cx-surface-2); min-width: 0; }
.cr-dup-card .pa-row-sub { overflow-wrap: anywhere; }
:where(.cr-dup-card) :where(button, select, input, textarea, summary, label, a:not(.pa-row-link)) { position: relative; z-index: 1; }   /* above its row link's overlay (ROW_LINK_V2) */
.cr-import, .cr-export { display: grid; gap: var(--pa-s3); }
.cr-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--pa-s3); }
.cr-map label { overflow-wrap: anywhere; }
.cr-sample td, .cr-data td { white-space: nowrap; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; }

/* ---- Compact (<= 640 px): one column, the page is the only scroller --------------------------- */
@media (max-width: 640px) {
  .pa-table.cr-contacts td.pa-pick-col { width: auto; }
  .pa-table.cr-contacts td:nth-child(2) { flex: 1 1 calc(100% - 60px); min-width: 0; }
  .pa-table.cr-contacts td[data-label] { font-size: 12px; }
  .pa-table.cr-contacts td.is-meta { margin-left: auto; }
  .cr-reason-list li { grid-template-columns: 3em minmax(0, 1fr); }
  .cr-reason-list li .pa-ev { grid-column: 2; justify-self: start; }
  .cr-check { flex-wrap: wrap; }
  .cr-check .pa-row-side { margin-left: 0; flex-basis: 100%; }
  .cr-occ-date { width: 5.5em; }
  .cr-signal-main strong { font-size: 20px; }
  .cr-saved { flex: 1 1 100%; }
  .cr-saved-pick { flex: 1 1 auto; }
}

/* Industry templates (screens/templates.js, screens/industry.js): the gallery wraps cards on a
   desktop and stacks them on a phone; card actions wrap so none sits past the edge. */
.ct-gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--pa-s3); }
.ct-card { display: flex; flex-direction: column; gap: var(--pa-s2); min-width: 0; }
.ct-card p { margin: 0; overflow-wrap: anywhere; }
.ct-card-actions { display: flex; flex-wrap: wrap; gap: var(--pa-s2); margin-top: auto; padding-top: var(--pa-s2); }
.ct-panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--pa-s3); }
.ct-tile { min-width: 0; }
.ct-list { margin: 0; padding-left: var(--pa-s4); display: flex; flex-direction: column; gap: var(--pa-s2); }
/* CR_UI_TARGETS_V1 (2026-10-30): a template's source links are 44 px tall on touch. */
@media (pointer: coarse) { .ct-src { display: inline-flex; align-items: center; min-height: var(--pa-tap); } }

/* UX scan, 2026-10-31 */
.cr-cell-edit:not(:hover):not(:focus) { border-color: transparent; background: transparent; }
.cr-filter-note { grid-column: 1 / -1; margin: 0; }
.cr-deal-filter-toggle { display: none; }
@media (max-width: 640px) {
  .cr-deal-filter-toggle { display: inline-flex; }
  .cr-deal-filters:not(.is-open) .pa-filter { display: none; }
}

/* Files (FB-AR2YRET6): received in conversations, and the library. */
.cr-files-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pa-s2); }
.cr-files-bar .pa-input { flex: 1 1 220px; min-width: 0; }
.cr-files-name { display: flex; align-items: center; gap: var(--pa-s2); min-width: 0; }
.cr-files-name .pa-cell-text { min-width: 0; overflow-wrap: anywhere; }
.cr-files-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--cx-radius-sm); background: var(--cx-surface-2); color: var(--cx-text-2); }

