/* ═══════════════════════════════════════════════════
   CONTACTS WORKSPACE (contacts.js)
   Builds on fundraising.css (.frp-inner, .fr-table, .fr-chip, .fr-drawer …) — only what is new here.
   ═══════════════════════════════════════════════════ */

/* People page */
.ct-toolbar #ct-q { flex: 1; min-width: 220px; }
.ct-chips { margin-bottom: 10px; }
.ct-chips .fr-chip { padding: 4px 11px; cursor: pointer; }
.ct-chips .fr-chip b { font-weight: 800; margin-left: 2px; }
.ct-status { font-size: 12px; color: var(--grey); margin: -2px 0 8px; display: flex; align-items: center; gap: 6px; }
.ct-status:empty { display: none; }
.ct-spin { width: 11px; height: 11px; border: 2px solid var(--border2); border-top-color: var(--green); border-radius: 50%; display: inline-block; animation: ct-spin .8s linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
.ct-note { background: #F8FAFC; border: 1px dashed var(--border2); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.ct-wrap { max-height: calc(100vh - 330px); min-height: 180px; }
.ct-table td { vertical-align: top; }
.ct-name { font-weight: 700; color: var(--text); font-size: 13px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; overflow-wrap: anywhere; }
.ct-sub { font-size: 11.5px; color: var(--grey); margin-top: 1px; overflow-wrap: anywhere; }
.ct-c-person { min-width: 170px; }
.ct-c-firm { min-width: 150px; max-width: 240px; }
.ct-c-firm .fr-link { font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.ct-c-met { white-space: nowrap; }
.ct-c-int { max-width: 260px; min-width: 140px; color: var(--text2); font-size: 12px; }
.ct-c-int span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ct-c-links { white-space: nowrap; text-align: right; }
.ct-c-links a, .ct-in { text-decoration: none; }
.ct-c-links a { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: var(--green); font-size: 13px; font-weight: 800; }
.ct-c-links a:hover { background: var(--sand); }
.ct-ffc { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; }
.ct-rel { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ct-mob { display: none; }
.ct-table tr.ct-is-left .ct-name { color: var(--text2); }
.ct-table tr.ct-empty-row td { text-align: center; padding: 36px; color: var(--grey); cursor: default; }
.fr-badge.ct-left-b { background: #FEF3C7; color: #92400E; }
.fr-badge.ct-want { background: #FFEDD5; color: #9A3412; }
.ct-hint-left { font-size: 12.5px; margin: 10px 2px 0; color: var(--text2); }
.ct-small { font-size: 11.5px; }

/* Buyer register: upcoming Outlook meetings, the firm's search profile (products), firms/people added from Outlook */
.ct-chip-sep { width: 1px; align-self: stretch; background: var(--border2); margin: 2px 4px; }
.fr-badge.ct-next-b { background: #EDE9FE; color: #6D28D9; }            /* same colours as the Meeting stage */
.fr-badge.ct-ol-b { background: #E0F2FE; color: #075985; }
.ct-ol-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.ct-notinv { color: #B91C1C; font-size: 11.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.ct-notinv:hover { text-decoration: underline; }
.ct-prods { display: flex; flex-wrap: wrap; gap: 5px; }
.ct-prods.sm { gap: 3px; margin-top: 3px; }
.ct-prod { display: inline-flex; align-items: center; background: var(--sand); border: 1px solid var(--sand2); color: var(--green3); border-radius: 12px; padding: 2px 9px; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.ct-prod.sm { padding: 0 6px; font-size: 10.5px; border-radius: 4px; }
.ct-lf { margin-top: 10px; }
.ct-lf .nd-label { margin-bottom: 3px; }
/* person card: the "Next meeting" line under the header */
.ct-next { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 10px; padding: 7px 10px; border-radius: 8px; background: #F5F3FF; border: 1px solid #DDD6FE; font-size: 12.5px; color: var(--text); }
.ct-next:empty { display: none; }
.ct-next-l { font-weight: 700; color: #6D28D9; }
.ct-next .ct-ffc { margin-left: 0; }
.ct-ol-note { margin-bottom: 12px; }
.ct-ol-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btn.ct-notinv-btn { color: #B91C1C; border-color: #FCA5A5; }
/* person card: Upcoming — a small calendar tile per meeting */
.ct-up { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #F1F3F5; align-items: flex-start; }
.ct-up:last-child { border-bottom: none; }
.ct-up-date { width: 42px; flex-shrink: 0; border: 1px solid #DDD6FE; border-radius: 8px; background: #F5F3FF; text-align: center; padding: 3px 0 4px; line-height: 1.15; color: #6D28D9; }
.ct-up-date span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.ct-up-date b { display: block; font-size: 17px; font-weight: 800; color: var(--text); }
/* person card: the Upcoming line on top of the firm's history */
.ct-up-line { background: #F5F3FF; border: 1px solid #DDD6FE; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 12.5px; color: var(--text2); }
.ct-up-line-h { font-weight: 700; color: #6D28D9; margin-bottom: 2px; }
.ct-up-li { padding: 2px 0; overflow-wrap: anywhere; }
.ct-up-li b { color: var(--text); }

/* Person card — sits just under the firm drawer (600/601), so "Open firm" stacks on top and closing it comes back here */
.fr-overlay.ct-overlay { z-index: 598; }
.fr-drawer.ct-drawer { z-index: 599; width: 620px; }
.fr-overlay.ct-overlay.ct-top { z-index: 602; }   /* opened from inside the firm drawer: goes on top of it (modals stay above at 700) */
.fr-drawer.ct-drawer.ct-top { z-index: 603; }
.ct-dh { padding-bottom: 12px; }
.ct-dh .fr-dh-meta a { cursor: pointer; }
.ct-pav { width: 42px; height: 42px; border-radius: 50%; background: var(--sand); border: 1px solid var(--sand2); color: var(--green); font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ct-pav.sm { width: 28px; height: 28px; font-size: 10.5px; }
.ct-links { margin-top: 10px; }
.ct-also { font-size: 12px; color: var(--text2); margin-top: 8px; line-height: 1.6; }
.ct-actions { margin: 12px 0 0; }
.ct-db .fr-card { padding: 14px 16px; }
.ct-db .fr-card + .fr-card { margin-top: 12px; }
.ct-db .fr-card-h { margin-bottom: 8px; }
.ct-card-n { font-size: 11px; font-weight: 600; color: var(--grey); text-transform: none; letter-spacing: 0; }
.ct-left-note { margin-bottom: 12px; }
.ct-int-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; align-items: center; }
.ct-notes { margin-top: 12px; }
.ct-pre { white-space: pre-wrap; font-size: 12.5px; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.ct-loading { padding: 12px 0; }
.ct-act { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #F1F3F5; align-items: flex-start; }
.ct-act:last-child { border-bottom: none; }
.ct-act-ic { width: 22px; text-align: center; font-size: 15px; flex-shrink: 0; line-height: 1.4; }
.ct-act-main { flex: 1; min-width: 0; }
.ct-act-h { font-size: 12px; color: var(--text2); display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; }
.ct-act-h b { color: var(--text); font-size: 12.5px; }
.ct-act-s { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.ct-act-b { font-size: 12px; color: var(--text2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-act-w { font-size: 12px; color: var(--text2); margin-top: 3px; }
.ct-act-ffc { display: flex; gap: 2px; flex-shrink: 0; }
.ct-who { cursor: pointer; color: var(--green); font-weight: 600; }
.ct-who:hover { text-decoration: underline; }
.ct-prow { cursor: pointer; }
.ct-prow:hover .fr-row-t { color: var(--green); text-decoration: underline; }
.ct-more-link { margin-top: 8px; font-size: 12px; }

/* Firm picker (Add person, Moved to another firm) — the list pushes the form down instead of floating, so it never gets clipped */
.ct-pick-list { border: 1px solid var(--border2); border-radius: 8px; margin-top: 4px; max-height: 250px; overflow-y: auto; background: white; }
.ct-pick-item { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid #F1F3F5; background: white; padding: 8px 10px; font-family: var(--font); font-size: 13px; color: var(--text); cursor: pointer; }
.ct-pick-item:last-child { border-bottom: none; }
.ct-pick-item small { display: block; font-size: 11.5px; color: var(--grey); margin-top: 1px; }
.ct-pick-item:hover, .ct-pick-item.hi { background: var(--sand); }
.ct-pick-new { color: var(--green); font-weight: 700; }
.ct-pick-sel { margin-top: 6px; }
.ct-pick-sel:empty { display: none; }
.ct-pick-chip { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; background: var(--sand); border: 1px solid var(--sand2); color: var(--green3); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; }
.ct-pick-chip.new { background: #F0F9FF; border-color: #BAE6FD; color: #075985; }
.ct-warn { color: #92400E; }
.ct-warn:empty { display: none; }

/* Phones: the table turns into stacked cards, the person card fills the screen */
@media (max-width: 768px) {
  .ct-wrap { max-height: none; min-height: 0; overflow: visible; }
  .ct-table thead { display: none; }
  .ct-table, .ct-table tbody { display: block; width: 100%; }
  .ct-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "person links" "firm firm" "rel met" "int int"; gap: 4px 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
  .ct-table tr:last-child { border-bottom: none; }
  .ct-table td { display: block; padding: 0; border: none; min-width: 0; max-width: none; }
  .ct-c-person { grid-area: person; }
  .ct-c-firm { grid-area: firm; }
  .ct-c-rel { grid-area: rel; }
  .ct-c-met { grid-area: met; text-align: right; font-size: 12px; }
  .ct-c-met.none { display: none; }
  .ct-c-int { grid-area: int; }
  .ct-c-int:empty { display: none; }
  .ct-c-links { grid-area: links; }
  .ct-mob { display: inline; }
  .ct-table tr.ct-empty-row { display: block; }
  .ct-table tr.ct-empty-row td { padding: 28px 12px; }
  .ct-toolbar #ct-q { min-width: 0; width: 100%; flex-basis: 100%; }
  .ct-toolbar .nd-select { flex: 1 1 42%; max-width: none; }
  .fr-drawer.ct-drawer { width: 100vw; }
  .ct-dh { padding: 14px 14px 10px; }
  .ct-db { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }   /* room to scroll past the app's bottom nav */
  .modal-overlay .modal.ct-modal { bottom: calc(60px + env(safe-area-inset-bottom)) !important; height: auto !important; }
  .ct-act-b { white-space: normal; }
}
