@layer base {
/* ============================================================
   Chat / Conversation View
   ============================================================ */

/* ── Layout ── */

.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr 260px;
  grid-template-rows: auto 1fr;
  /* Takes the space left over rather than all of it: see .main:has() below. */
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* When no filter bar exists, the auto row collapses to 0 */

/* Chat pages need edge-to-edge layout — remove main padding and prevent double-scroll */
.main:has(.chat-layout) {
  padding: 0;
  overflow: hidden;
  /* A column flex parent, so anything rendered above the grid takes its own
     height and the grid gets the remainder. With `height: 100%` on the grid
     instead, the messages banner pushed a full-height grid down by its own
     height and the `overflow: hidden` here clipped that much off the bottom —
     with no scrollbar to recover it, so the foot of the counterpart list and
     the chat composer were simply unreachable. Measured live on dev: 129px
     lost, document scroll height 0 (METIS-pub#397 review). */
  display: flex;
  flex-direction: column;
}

/* ── Filter bar ── */

.chat-filters {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

/* chat-filter-select is used as an hx-include target class, no visual styles needed */
/* toggle-focus dropdown styles are in base.css (global) */
/* journey-picker and journey-type-btn styles are in table.css (shared) */

.chat-filters .search-input {
  width: 180px;
  padding: 4px 10px;
  font-size: var(--text-base);
}

/* ── Sidebar (counterpart list) ── */

.chat-sidebar {
  grid-row: 2;
  overflow-y: auto;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

/* ── Counterpart rows ── */

.chat-counterpart {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.875rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  border-left: 3px solid transparent;
}

.chat-counterpart:hover {
  background: var(--bg);
}

/* No row tint for a follow-up's state (#826, cognitive load): the date headings
   (Overdue / Today / Coming up) already group the rows and the date is red when
   late, so a pink list of 90 overdue rows only shouted. */

/* After the follow-up tints, and as specific as their :hover, so the selected
   row keeps its own background on every dated row (METIS-pub#765). */
.chat-counterpart--active,
.chat-counterpart--active:hover {
  background: var(--bg);
  border-left-color: var(--accent);
}

.chat-counterpart__body {
  flex: 1;
  min-width: 0;
}

.chat-counterpart__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem;
}

.chat-counterpart__name,
.chat-counterpart__name-link {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.chat-counterpart__name-link:hover {
  text-decoration: underline;
}

.chat-counterpart__time {
  font-size: var(--text-xs);
  color: var(--text-light);
  flex-shrink: 0;
  white-space: nowrap;
}

.chat-follow-up-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}
.chat-follow-up-badge--overdue {
  background: var(--overdue-bg, #fce4ec);
  color: var(--overdue-color, #c62828);
}
.chat-follow-up-badge--today {
  background: #fff8e1;
  color: #f57f17;
}
.chat-follow-up-badge--future {
  background: #e8f5e9;
  color: #2e7d32;
}

.chat-counterpart__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-counterpart__preview {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* App section header in the grouped class list sidebar. */
.browse-list__group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.5rem 0.75rem 0.25rem;
}
.browse-list__group-label:not(:first-child) {
  border-top: 1px solid var(--border-light);
  margin-top: 0.25rem;
}

/* Sidebar action slot — the one primary action a two-panel listing offers
   before anything is selected (e.g. "Create invitation page"). Lives here
   rather than in one app's stylesheet because every chat-layout sidebar has the
   same problem: its list has no header to hang an action on. */
.browse-list__actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}

/* ── Avatars ── */

.chat-counterpart__avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.chat-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Larger avatar for conversation header */
.chat-conv-header .chat-avatar-img,
.chat-conv-header .chat-avatar-initials {
  width: 40px;
  height: 40px;
  font-size: var(--text-base);
}

/* The small picture beside a feed name (METIS-pub#756), drawn by
   crm/partials/_entity_name.html. A modifier, never a change to the base
   rules, which the agent hub and the left list use at 36px; declared after
   the header rule above so it wins at equal specificity. */
.chat-avatar-img.chat-avatar--sm,
.chat-avatar-initials.chat-avatar--sm {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  font-size: var(--text-xs);
}

/* ── Main conversation panel ── */

.chat-main {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: var(--bg);
}

.chat-conversation-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Right info panel ── */

.chat-info {
  grid-row: 2;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  padding: 0;
  /* The page motif ([data-app-motif] .main::after in base.css) is a fixed,
     multiply-blended pseudo-element of .main, so it paints over every
     non-positioned descendant — including this panel, which is the densest
     body copy on a list page and the one place the design system says a
     backdrop must never go. Positioning the panel with a z-index puts it
     above the motif; the list surfaces behind it stay transparent and keep
     theirs. */
  position: relative;
  z-index: 1;
}

/* Hide info panel when it only has the empty placeholder */
.chat-info:has(> .chat-info-empty:only-child) {
  display: none;
}

.chat-layout:has(.chat-info:has(> .chat-info-empty:only-child)),
/* Pages that reuse this grid without a third .chat-info column (e.g. the
   classes list) opt into a two-column layout so no empty 260px track is left. */
.chat-layout--two-col {
  grid-template-columns: 300px 1fr;
}

/* Only an open extension side panel hides the info panel (METIS-pub#765):
   an installed extension with its panel closed leaves it showing. */
[data-metis-sidepanel-open="1"] .chat-layout {
  grid-template-columns: 300px 1fr;
}

[data-metis-sidepanel-open="1"] .chat-info {
  display: none;
}

.chat-info-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: var(--text-base);
  text-align: center;
  padding: 1rem;
}

.chat-info-empty p {
  margin: 0;
}

/* Profile header: photo/logo + name stacked */
.chat-info__profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

/* Compact photo for the panel */
.chat-info__profile-header .person-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  cursor: default;
  border: none;
}

.chat-info__profile-header .person-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-info__profile-header .person-photo:hover {
  border-color: var(--border);
}

.chat-info__profile-header img.holon-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
}

/* A name that opens its page: the info column's, and every feed name drawn by
   crm/partials/_entity_name.html (METIS-pub#755). It reads as a name, not a
   link: the colour is inherited here and set by the host class declared after
   it (.chat-info__name, .chat-message__author, …). The hover is in
   @layer components below, because the header's name sets its colour there. */
.entity-name-link {
  color: inherit;
  text-decoration: none;
}

/* A name with its picture (METIS-pub#756): picture and name on one line,
   wrapping as one unit. The text carries the ellipsis, because a flex
   container's own text-overflow does not reach its text. */
.entity-name--pictured {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  vertical-align: middle;
}
.entity-name--pictured > .icon { flex-shrink: 0; }
.entity-name__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Name display */
.chat-info__name {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
}

/* Whole-header link: the entire identity block opens the entity, so the click
   target is the box the eye already treats as one thing, not just the title. */
.chat-info__header-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}

.chat-info__header-link:hover {
  background: var(--surface-alt);
}

.chat-info__header-link:hover .chat-info__name {
  color: var(--accent);
  text-decoration: underline;
}

.chat-info__header-date {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.chat-info__header-id {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Location / sphere line */
.chat-info__meta-line {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

/* Description snippet */
.chat-info__description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  padding: 0 0.25rem;
}

/* Recording video */
.chat-info__recording {
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  max-height: 180px;
}

/* Contact icons row */
.chat-info__contact-icons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.chat-info__contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.chat-info__contact-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--border-light);
}
.chat-info__contact-icon svg {
  width: 14px;
  height: 14px;
}

.chat-info__holon-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.chat-info__full-link {
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.25rem;
}

.chat-info__full-link:hover {
  text-decoration: underline;
}

/* Field rows inside the panel — compact */
.chat-info .field-row {
  border-bottom: 1px solid var(--border-light);
  padding: 0 0.75rem;
}

.chat-info .field-row:last-of-type {
  border-bottom: none;
}

.chat-info .field-display {
  padding: 0.5rem 0.25rem;
  gap: 0.25rem;
  flex-direction: column;
  align-items: flex-start;
}

.chat-info .field-label {
  font-size: var(--text-xs);
  min-width: unset;
}

.chat-info .field-value {
  font-size: var(--text-base);
  word-break: break-word;
}

/* Info block: label + value pairs rendered from an entity's publishing fields.
   The long text bodies are read, not skimmed, so they carry --text at the base
   step — --text-light one step down was the low-contrast complaint. */
.chat-info__fields {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-info__field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.chat-info__field-text {
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-info__field-value {
  font-size: var(--text-base);
  color: var(--text);
  font-weight: 500;
}

/* Section divider + label (Flows / Relationships) */
.chat-info__section-divider {
  padding: 0.625rem 0.75rem 0.25rem;
  border-top: 1px solid var(--border-light);
  margin-top: 0.25rem;
}

.chat-info__section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Flow/relationship rows inside panel */
.chat-info__flow-row {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.chat-info__flow-row:last-of-type {
  border-bottom: none;
}

.chat-info__flow-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-info__flow-org-logo {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.chat-info__flow-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.chat-info__flow-journey {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.chat-info__flow-responsible {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.chat-info__flow-date {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Conversation header ── */

.chat-conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 1rem;
}

.chat-conv-header__left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.chat-conv-header__info {
  min-width: 0;
}

.chat-conv-header__name {
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conv-header__context {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 1px;
}

.chat-conv-header__flows {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  flex-shrink: 0;
}

/* ── Feed ── */

.chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  scroll-behavior: smooth;
}

/* ── Date separators ── */

.chat-date-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 12px 0 8px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-date-sep::before,
.chat-date-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ── Messages ── */

.chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;   /* others: left */
  margin-bottom: 8px;
  max-width: 100%;
}

.chat-message--cluster {
  margin-bottom: 2px;
}

/* Own messages sit on the right */
.chat-message--own {
  align-items: flex-end;
}

/* Bubble wrapper caps the width */
.chat-message__bubble {
  max-width: 72%;
}

/* Meta row (author + time) */
.chat-message__meta {
  display: flex;
  /* Centre, not baseline: the names carry a 20px picture (#756), and a
     picture's baseline is its bottom edge, which lifted the time label. */
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 3px;
  padding: 0 4px;
}

.chat-message--own .chat-message__meta {
  flex-direction: row-reverse;
}

.chat-message__author {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.chat-message__counterpart {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}
.chat-message__counterpart::before { content: "·"; margin-right: 0.25rem; }

.chat-message__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Cluster: show only a tiny time stamp, tucked to the correct side */
.chat-message__time-only {
  font-size: var(--text-xs);
  color: var(--text-light);
  margin-bottom: 2px;
  padding: 0 6px;
  align-self: flex-start;
}

.chat-message--own .chat-message__time-only {
  align-self: flex-end;
}

/* The actual body bubble */
.chat-message__body {
  font-size: var(--text-md);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-lg);

  /* others: neutral surface */
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

.chat-message--own .chat-message__body {
  /* own: accent */
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}
.chat-message--own .chat-message__body a {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
}

/* Cluster messages shorten the leading corner */
.chat-message--cluster:not(.chat-message--own) .chat-message__body {
  border-top-left-radius: 4px;
}

.chat-message--cluster.chat-message--own .chat-message__body {
  border-top-right-radius: 4px;
}

.chat-message__video {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  margin-top: 4px;
  display: block;
}

/* Flow pill and refs sit below the bubble, same side */
.chat-message__flow,
.chat-message__refs {
  margin-top: 3px;
  padding: 0 4px;
}

.chat-message__refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chat-flow-pill {
  display: inline-block;
  font-size: var(--text-xs) !important;
  border-radius: var(--radius-md) !important;
  padding: 1px 7px !important;
  font-weight: 500;
  line-height: 1.5;
}

.chat-flow-pill--subtle {
  opacity: 0.65;
}

/* Note type badge in meta row */
.chat-message__type {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: var(--radius-md);
  background: var(--border-light);
  color: var(--text-muted);
}

.chat-message__type--flow { background: var(--success-bg); color: var(--success-color); }

/* ── Composer ── */

.chat-composer {
  border-top: 1px solid var(--border);
  padding: 0.625rem 1rem;
  background: var(--surface);
  flex-shrink: 0;
}

.chat-composer__flow-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.chat-composer__flow-row--select {
  flex-wrap: nowrap;
}
.chat-composer__flow-row--select .chat-flow-selector {
  flex: 1;
  min-width: 0;
}

.chat-composer__posting-to {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.chat-composer__flow-label {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.chat-composer__flow-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chat-composer__flow-radio:not(:checked) + .chat-flow-pill {
  opacity: 0.45;
  background: var(--border) !important;
  color: var(--text-muted) !important;
}

.chat-composer__input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-composer__textarea {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: var(--text-md);
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  line-height: 1.4;
  transition: border-color var(--dur-base) var(--ease-out);
}

.chat-composer__textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-composer__send {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--dur-base) var(--ease-out);
  flex-shrink: 0;
  align-self: flex-end;
}

.chat-composer__send:hover {
  opacity: 0.88;
}

.chat-composer__no-flows {
  font-size: var(--text-base);
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0;
}

/* ── Empty states ── */

.chat-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-md);
}

.chat-empty-state--full {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.chat-empty-state p {
  margin: 0;
}

/* ── Journey pipeline sidebar ── */

.pipeline-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Journey tree (top section, fixed) */
.pipeline-tree {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  overflow-y: auto;
  max-height: 40%;
}

/* Journey row */
.pipeline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  font-size: var(--text-base);
  color: var(--text);
  transition: background var(--dur-fast) var(--ease-out);
}
.pipeline-row:hover { background: var(--bg); }
.pipeline-row--active {
  background: var(--bg);
  border-left-color: var(--accent);
}

.pipeline-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.pipeline-row__type {
  font-size: var(--text-xs);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* Step rows (children) */
.pipeline-row--step {
  padding-left: 1.5rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 400;
}

.pipeline-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Expand/collapse */
.pipeline-expand-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform var(--dur-base) var(--ease-out);
}
.pipeline-expand-btn.open { transform: rotate(90deg); }

.pipeline-steps { display: none; }
.pipeline-steps.open { display: block; }

/* Counterpart list (bottom section, scrolls) */
.pipeline-counterpart-list {
  flex: 1;
  overflow-y: auto;
}


/* ── Responsive ── */

@media (max-width: 1024px) {
  .chat-layout {
    grid-template-columns: 300px 1fr;
  }
  .chat-info {
    display: none;
  }
}

@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .chat-sidebar {
    grid-row: 2;
    display: flex;
    /* Column, not the default row: a row flex item grows to its widest
       nowrap line, so the list overflowed the screen sideways and the "…"
       truncation never applied (METIS-pub#657). */
    flex-direction: column;
  }

  .chat-main {
    grid-row: 2;
    display: none;
  }

  .chat-layout.chat--conversation-open .chat-sidebar {
    display: none;
  }

  .chat-layout.chat--conversation-open .chat-main {
    display: flex;
  }

  .chat-filters {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .chat-filter-select {
    min-width: 0;
    flex: 1;
  }
}

/* Browse list inside sidebar scrolls like counterpart list */
.browse-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ── Browse pages (locations, spheres) ── */

.browse-main {
  /* .chat-main is a column flex container. Take its remaining height and allow
     this item to shrink so overflow belongs to this panel; height:100% can put
     the panel's true bottom below the clipped viewport when a sibling exists. */
  flex: 1;
  min-height: 0;
  padding: 1rem;
  overflow-y: auto;
}

.browse-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.browse-header__content {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}
.browse-header__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  object-fit: contain;
  flex-shrink: 0;
  background: var(--border-light);
  padding: 4px;
}
.browse-header__text {
  min-width: 0;
}
.browse-header__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}
.browse-header__meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.browse-header__inactive {
  color: var(--text-light);
}
.browse-header__desc {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0.3rem 0 0;
  line-height: 1.5;
}
.browse-header__action {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0.2rem;
  border-radius: var(--radius);
  flex-shrink: 0;
  margin-top: 2px;
}
.browse-header__action:hover {
  color: var(--text);
  background: var(--border-light);
}
.browse-header__action svg {
  width: 15px;
  height: 15px;
}
.browse-section .field-display {
  cursor: default;
}
.browse-section .field-display:hover {
  background: transparent;
}

.browse-section {
  margin-bottom: 1.5rem;
}
.browse-section__label {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
}

.browse-section__inherited {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
  opacity: 0.75;
}
.browse-section__inherited a {
  color: inherit;
}

.browse-section--disabled .browse-section__label {
  opacity: 0.6;
}
.browse-section__disabled-badge {
  display: inline-block;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.1em 0.45em;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--text-muted) 12%, transparent);
  color: var(--text-muted);
  font-size: 0.78em;
}
.class-section-disabled-notice {
  font-size: var(--text-base);
  color: var(--text-muted);
  font-style: italic;
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--border-light);
  background: color-mix(in oklab, var(--surface-alt, var(--surface)) 50%, transparent);
}

.browse-entity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: background var(--dur-fast) var(--ease-out);
}
.browse-entity:hover {
  background: var(--border-light);
}

.browse-entity__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.browse-entity__initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  flex-shrink: 0;
  background: var(--border-light);
  color: var(--text-muted);
}
.browse-entity__name {
  font-size: var(--text-base);
  font-weight: 500;
}
.browse-entity__type {
  font-size: var(--text-xs);
  margin-left: auto;
}

/* A member entity plus its labelled additional fields (object class panel). */
.browse-member {
  margin-bottom: 0.75rem;
}
.browse-member__field {
  padding-left: 2.5rem; /* align under the name, past the avatar + gap */
}

/* Short explanatory line under a browse-section label. */
.browse-section__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0.5rem 0 0.4rem;
}

/* Small explanatory line shown below a field's value, describing what it means. */
.field-value__hint {
  display: block;
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--text-light);
  line-height: 1.3;
}

/* A connected journey: type-coloured pill + class + its step badges. */
.class-journey {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}
.class-journey:last-child {
  border-bottom: none;
}
.class-journey__class {
  font-size: var(--text-sm);
}
.class-journey__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: auto;
}
.class-journey__nosteps {
  font-size: var(--text-xs);
}

/* Additional info-field schema groups (field definitions, not values) are drawn
   by `.field-block` (components/field-block.css) since METIS-pub#450 — chrome
   AND spacing, so nothing is left here. `.class-field-group` itself is gone:
   the panel emits `field-block`, so a rule on the old name would match nothing
   while reading as if it still did. The nested-margin reset below is renamed
   with it. */
/* Ordered list of field definitions, one row per field. */
.class-field-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}
.class-field-row {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  align-items: flex-start;
}
.class-field-row:last-child { border-bottom: none; }
.class-field-row:nth-child(even) { background: color-mix(in oklab, var(--surface) 94%, var(--border-light)); }
/* A display-block row may carry a nested field list (links / info fields);
   give that nested content room to breathe under the block's label + hint. */
.class-field-block .class-field-list { margin-top: 0.5rem; }
.class-field-block .field-block:first-of-type { margin-top: 0.5rem; }
/* Per-block source: whether the block comes from this class or is inherited. */
.class-block-source {
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--text-light);
}
.class-block-source a { color: inherit; }
.class-block-source--own {
  font-style: normal;
  color: var(--text-muted);
  background: var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.05rem 0.35rem;
}
.class-field-row--empty {
  padding: 0.65rem 0.8rem;
  color: var(--text-muted);
  font-size: var(--text-base);
}
/* A detail_sections key nothing renders: marked where it sits in the list.
   Doubled class so it outranks the :nth-child(even) stripe above — a dead key
   in an even position otherwise keeps the stripe and loses the warning. */
.class-field-row.class-field-row--unknown {
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning-border);
}
.class-field-row--unknown .class-field-row__label { color: var(--color-warning); }
.class-field-row__broken { color: var(--color-warning); }
.class-field-row__num {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-light);
  background: var(--border-light);
  border-radius: var(--radius-full);
  margin-top: 0.1rem;
}
.class-field-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.class-field-row__topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.class-field-row__label {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.2;
}
.class-field-row__badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex-shrink: 0;
}
.class-field-row__key {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.05rem 0.3rem;
}
.class-field-row__help {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}
.class-field-row__detail {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}
.class-field-row__detail-label {
  font-weight: 600;
  color: var(--text-light);
}
.class-field-row__link {
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.class-field-row__link:hover { text-decoration: underline; }

/* Type badge colour hints. Shape moved onto these classes directly (issue
   #208 PR6) rather than relying on .rel-badge for it — .rel-badge became
   .chip, and .chip sets its own background/color in @layer components,
   which would flatten these per-type colours regardless of source order. */
.class-field-type-badge,
.class-field-req-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  margin: 1px 2px;
}
.class-field-type-badge {
  font-family: ui-monospace, monospace;
  background: var(--border-light);
  color: var(--text-muted);
}
.class-field-type-badge--select   { background: #e3f2fd; color: #1565c0; }
.class-field-type-badge--text-area { background: #f3e5f5; color: #6a1b9a; }
.class-field-type-badge--button    { background: #fff3e0; color: #bf360c; }
.class-field-type-badge--video,
.class-field-type-badge--slideshow { background: #fce4ec; color: #880e4f; }
.class-field-req-badge { background: #fff8e1; color: #f57f17; }

/* Collapsible options panel (looks like a select dropdown). */
.class-field-select {
  margin-top: 0.2rem;
}
.class-field-select__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  list-style: none;
}
.class-field-select__summary::-webkit-details-marker { display: none; }
.class-field-select__arrow {
  display: inline-block;
  font-size: var(--text-xs);
  transition: transform var(--dur-base) var(--ease-out);
  color: var(--text-light);
}
details[open] .class-field-select__arrow { transform: rotate(90deg); }
.class-field-select__list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 260px;
}
.class-field-select__opt {
  padding: 0.3rem 0.6rem;
  font-size: var(--text-sm);
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}
.class-field-select__opt:last-child { border-bottom: none; }
.class-field-select__opt:first-child {
  border-top-left-radius: calc(var(--radius) - 1px);
  border-top-right-radius: calc(var(--radius) - 1px);
}
.class-field-select__opt:last-child {
  border-bottom-left-radius: calc(var(--radius) - 1px);
  border-bottom-right-radius: calc(var(--radius) - 1px);
}

/* Collapsible raw config block. */
.browse-rawconfig summary {
  cursor: pointer;
  list-style: revert;
}
.browse-rawconfig__pre {
  white-space: pre-wrap;
  overflow: auto;
  margin-top: 0.5rem;
  font-size: var(--text-sm);
}

/* .filter-mine-avatar and .filter-mine-initials are in base.css */
}

/* A journey:step chip in the info-panel header is a sentence, not a tag, and
   the panel is 340px wide — .chip's own white-space: nowrap ran it off the
   edge. The chip keeps its shape and colours; only the line-breaking is local.
   In @layer components rather than base above, because a base rule loses to
   chip.css no matter how specific it is. */
@layer components {
  .chat-info__header-link .chip {
    white-space: normal;
    text-align: center;
  }
}

/* The conversation panel's header: who these notes are about, and (when the
   caller offers one) the scope toggle. Added with METIS-pub#418 — the panel
   had no header at all, so on a detail page it changed contents silently.
   .detail-sidebar--chat .chat-feed already takes the remaining height, so this
   needs no height rule of its own. */
@layer components {
  .chat-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
  }

  /* On a holon page's Activity section the header would only repeat the
     page's own name, so it is left out unless it carries the scope toggle
     (METIS-pub#801). Here, not in detail.css with the section's other rules,
     because .chat-panel-head's display is set in this layer. */
  .holon-activity .chat-panel-head:not(:has(.chat-panel-head__scope)) {
    display: none;
  }

  .chat-panel-head__name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .entity-name-link:hover {
    color: var(--accent);
  }
  /* The underline goes on the name's text, never on a pictured link itself:
     a decoration set on a flex container reaches its items, and no item can
     take it off again, so it underlined the initials in the circle (#756). */
  .entity-name-link:hover:not(.entity-name--pictured),
  .entity-name-link:hover .entity-name__text {
    text-decoration: underline;
  }

  .chat-panel-head__scope {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
  }

  /* The two sides are one control, so they read as a pair rather than two
     unrelated chips. */
  .chat-panel-head__scope .chip {
    cursor: pointer;
    white-space: nowrap;
  }
}

/* The feed layout of the conversation panel (METIS-pub#801): every holon and
   person page. The comment box comes first and the newest entry under it;
   METIS's own records are quiet one-line entries (.feed-record) and what
   people wrote shows in full, with no bubble (.feed-comment). The chat page
   and Coherence keep the bubbles above. In @layer base with the rules it
   restyles, after them, so it wins on order where specificity ties. */
@layer base {
  /* The comment box as a box of its own above the feed, not a footer bar. */
  .chat-composer:has(+ .chat-feed--rows) {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
  }

  /* The day's label sits left, over a rule, rather than between two. */
  .chat-feed--rows .chat-date-sep {
    margin: var(--space-6) 0 0;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border-light);
  }
  .chat-feed--rows .chat-date-sep::before,
  .chat-feed--rows .chat-date-sep::after {
    display: none;
  }

  /* A record: picture, name, the sentence cut to one line, the time at the
     right. The whole sentence is in the text's title. */
  .feed-record {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
    color: var(--color-text-muted);
    min-width: 0;
  }
  .feed-record__author {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--color-text);
  }
  .feed-record__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* A mention pill is inline-block, which an ellipsis cannot cut: inline
     here, so a long record still ends in "…". (A move's pictured counterpart
     stays one unit and is clipped at the edge.) */
  .feed-record__text .note-mention {
    display: inline;
  }
  .feed-record__counterpart::before {
    content: "·";
    margin-right: var(--space-1);
  }
  .feed-record__time {
    flex-shrink: 0;
    font-size: var(--text-sm);
  }
  /* A line that continues its author's run: no picture or name, as a chat
     app does, and its sentence starts where the name stood (past the small
     picture, .chat-avatar--sm, and the name's gap). */
  .feed-record--continued {
    padding-left: calc(var(--space-3) + 20px + var(--space-xs));
  }

  /* A comment: picture in its own column, then who, where and when, then the
     whole body. A divider closes it, and opens it after a run of records. */
  .feed-comment {
    display: grid;
    /* A fixed picture column, so a clustered comment, which has no picture,
       lines its body up under the one before. */
    grid-template-columns: var(--space-8) 1fr;
    column-gap: var(--space-3);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border-light);
  }
  .feed-record + .feed-comment:not(.feed-comment--cluster) {
    border-top: 1px solid var(--color-border-light);
    margin-top: var(--space-2);
  }
  /* No divider inside a run of one person's rows. */
  .feed-comment:has(+ .feed-comment--cluster, + .feed-record--continued) {
    border-bottom: none;
    padding-bottom: 0;
  }
  /* A comment continuing its author's record carries its name for the
     Comments filter (.holon-activity--comments, detail.css), which hides the
     record; everywhere else the name is left out like any continuation. */
  .feed-comment--named-among-notes:not(.holon-activity--comments *) :is(.feed-comment__picture, .feed-comment__meta--named),
  .holon-activity--comments .feed-comment--named-among-notes .feed-comment__meta--continued {
    display: none;
  }
  /* Under that filter the records are hidden but still siblings: a comment
     whose run went on into a record keeps its divider, or the next comment
     shown, someone else's, would run into it. */
  .holon-activity--comments .feed-comment:has(+ .feed-record--continued) {
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: var(--space-4);
  }
  .feed-comment__picture {
    grid-row: span 3;
  }
  .feed-comment__picture .chat-avatar-img,
  .feed-comment__picture .chat-avatar-initials {
    width: var(--space-8);
    height: var(--space-8);
  }
  .feed-comment__meta,
  .feed-comment__body,
  .feed-comment__flow {
    grid-column: 2;
    min-width: 0;
  }
  .feed-comment__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }
  .feed-comment__author {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--color-text);
  }
  .feed-comment__body {
    margin-top: var(--space-1);
    font-size: var(--text-md);
    line-height: 1.5;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
  }
  .feed-comment__flow {
    margin-top: var(--space-1);
  }
}

/* The Updates page as two panes (METIS-pub#812; #825, version A). Under the
   strip and the band, the list (its filters on top) and, once a row is opened,
   the side panel. Each pane is the one box that scrolls: the conversation, the
   feed and the info column inside the panel are let out of their own scroll
   boxes here, because a box with no height of its own never scrolls, which is
   how a person opened from the list became unscrollable. The page itself
   never scrolls (.main:has(.chat-layout) above). The grid and the boxes inside
   it are shared with other two-panel pages, so everything here hangs off the
   page's own .chat-layout--panes. In this layer so it wins over the base
   layout rules above, the media queries and the extension's hide included. */
@layer components {
  /* The list runs flush to the tabs, the window's foot and the side panel
     (METIS-pub#845); its rows keep their own inset. */
  .chat-layout--panes {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: 0;
  }
  /* The panel is the shared side panel (components/side-panel.css): from
     under the strip, beside the band and the page, not a column of
     this grid (METIS-pub#825 version B). The list takes the page's width. */

  .chat-pane {
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--color-surface);
  }

  /* The filters stay on top of the list as it scrolls. */
  .chat-pane--list .chat-filters {
    position: sticky;
    top: 0;
  }

  /* The panel shows once a conversation has brought its head (the shared
     rule); until then, and on a phone for the row opened by default, none. */
  .chat-pane--side {
    display: none;
  }
  /* A person's pane, wherever the side panel holds it (Outreach's, or the
     item a row opened on Home: [data-side-panel-item]). The out-of-band info
     panel's own box is dropped, so its head is a child of the scrolling
     panel for position: sticky. */
  :is(.chat-pane--side, [data-side-panel-item]) .chat-info {
    display: contents;
  }
  /* Inset like the panel's other parts (and a holon summary's notes,
     .side-panel__notes): the feed and its box no longer run to the edge. */
  :is(.chat-pane--side, [data-side-panel-item]) .chat-conversation-panel {
    flex: 1 0 auto;
    min-height: auto;
    padding: var(--space-3) var(--space-4) var(--space-4);
    overflow: visible;
  }
  :is(.chat-pane--side, [data-side-panel-item]) .chat-feed {
    flex: 1 0 auto;
    overflow: visible;
  }
  :is(.chat-pane--side, [data-side-panel-item]) .chat-composer {
    position: sticky;
    bottom: 0;
    z-index: 1;
  }
  /* The head above says whose notes these are; the feed's own name line is
     kept only when it carries the scope toggle (as on a holon's Activity). */
  :is(.chat-pane--side, [data-side-panel-item]) .chat-panel-head:not(:has(.chat-panel-head__scope)) {
    display: none;
  }
  /* The details read left to right under the head, not as a centred card. */
  :is(.chat-pane--side, [data-side-panel-item]) .chat-info__profile-header,
  :is(.chat-pane--side, [data-side-panel-item]) .chat-info__profile-header > * {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
  }
  :is(.chat-pane--side, [data-side-panel-item]) .chat-info__profile-header:not(:has(*)) {
    display: none;
  }

  /* A row's picture lies over its initials, so a picture that fails to load
     (removed by its onerror) leaves the initials, never its alt text. */
  .chat-counterpart__avatar {
    position: relative;
  }
  .chat-counterpart__avatar .chat-avatar-img {
    position: absolute;
    inset: 0;
  }

  /* On a phone the panel opened from a row is the shared sheet; the row
     opened by default waits for a tap (it carries no [data-sheet]). */
  @media (max-width: 768px) {
    .chat-layout--panes {
      padding: 0;
    }
  }
}

/* The Updates panel's Flows rows, which are their own editor (METIS-pub#826
   M4; crm/chat/partials/_flow_row.html, crm/js/chat_flow_row.js). A label
   column, then the value: the step chip, the date, the responsible's face and
   name. The date is the quick date; each other value is drawn as text and a native control lies over it,
   transparent (.flow-row__overlay), so a click on what you see opens that
   value's menu or picker, and the keyboard reaches a real select. */
@layer components {
  .flow-row__fields {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-1) var(--space-3);
    align-items: center;
    margin: var(--space-1) 0 0;
  }

  .flow-row__field { display: contents; }

  .flow-row__fields dt {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
  }

  .flow-row__fields dd {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    margin: 0;
  }

  .flow-row__pick {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    min-height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
  }

  .flow-row__pick:focus-within {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }

  .flow-row__pick:hover .person-face__name {
    text-decoration: underline;
  }

  .flow-row__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
  }

  .flow-row__caret {
    margin-left: var(--space-1);
    font-size: var(--text-xs);
    opacity: 0.7;
  }

  .flow-row__pick .person-face__name { font-size: var(--text-sm); }

  .flow-row__empty {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
  }

  .flow-row__select {
    max-width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-sm);
  }

  /* The quick date (crm/css/components/follow-up-row.css) fills the cell. */
  .flow-row__date-cell > .date-quick { flex: 1 1 auto; min-width: 0; }
}

/* A list row's responsible: the face alone, small, before the date
   (METIS-pub#826 M4). The name stays in the markup for screen readers. */
@layer components {
  .chat-counterpart__responsible {
    display: inline-flex;
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
  }

  .chat-counterpart__responsible .person-face__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
