/* The chat list, its row menu, Archived, Do not disturb, the toast, New chat and the new-message card (#2111;
   canvas "MeshLink Web Screens", boards Main, chats-*, new-chat*, new-message-banner; web.css's .w-list rules).
   Every colour, size and type style is a token from design/tokens.json (tokens.css, written by
   `tools/keel gen-tokens`); no literal where a variable exists. Logical properties only. Loaded in index.html's order:
   frame, start, chats, conversation, media, contact, calls, settings. */

/* The list pane's view: the head, the banner and the chips stay; the rows scroll under them. */
.w-list > .chat-list { overflow: hidden; background: var(--surface); }
.chat-head .icon-button { color: var(--mesh); }
.chat-head--back { padding-inline-start: var(--space-2); }

/* Do not disturb (board chats-banners): a mesh-tinted banner between the head and the chips. */
.chat-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2-half);
  flex: none;
  margin: var(--space-1) var(--space-4) var(--space-2);
  padding: var(--space-2-half) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--mesh-tint);
  color: var(--ink);
}
.chat-banner > .icon { flex: none; color: var(--mesh); }
.chat-banner__title { flex: 1 1 auto; min-inline-size: 0; font: var(--callout-strong-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }
.chat-banner__action {
  flex: none;
  min-block-size: var(--touch-min);
  padding: 0;
  border: none;
  background: none;
  color: var(--mesh);
  font: var(--callout-strong-weight) var(--callout-size) / var(--callout-line) var(--callout-family);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The state chips: All, Unread N (the kit's ml-statechip). */
.chat-filters { display: flex; gap: var(--space-2); flex: none; padding: 0 var(--space-4) var(--space-2-half); }
.chat-chip {
  display: inline-flex;
  align-items: center;
  block-size: var(--state-chip);
  padding-inline: var(--space-2-half);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink);
  font: var(--tab-weight) var(--footnote-size) / var(--footnote-line) var(--footnote-family);
  white-space: nowrap;
}
.chat-chip--on { background: var(--mesh); color: var(--on-mesh); }

/* The rows: rounded and inset, 2 apart; a chat row is a disc, the name over the preview, the time over the badge. */
.chat-rows { display: flex; flex-direction: column; gap: var(--space-half); flex: 1 1 auto; min-block-size: 0; padding-block-end: var(--space-2); }
.chat-row { gap: var(--space-3); min-block-size: var(--avatar-lg); padding: var(--space-2-half) var(--space-3); border-radius: var(--radius-menu); }
.chat-row--archived { min-block-size: var(--row-min); }
.chat-row__lead { display: grid; place-items: center; inline-size: var(--avatar-row); flex: none; color: var(--ink-muted); }
.row-face .disc { width: var(--avatar-row); height: var(--avatar-row); font-size: var(--title-size); }
.group-disc { background: var(--surface-sunken); color: var(--ink-muted); }
.chat-row .row-main { gap: var(--space-half); }
.row-head { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.chat-row__title { font: var(--headline-weight) var(--headline-size) / var(--headline-line) var(--headline-family); }
.row-muted, .row-verified { display: inline-flex; flex: none; color: var(--ink-muted); }
.row-verified { color: var(--mesh); }
.chat-row__sub {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  color: var(--ink-muted);
  font: var(--footnote-weight) var(--footnote-size) / var(--footnote-line) var(--footnote-family);
}
.chat-row__sub .icon { flex: none; }
.chat-row__sub.typing { color: var(--mesh); font-weight: var(--footnote-strong-weight); }
.chat-row__sub.danger, .chat-row__sub--failed { color: var(--danger); }
.chat-row__sub--failed { font-weight: var(--footnote-strong-weight); }
.row-preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tick { display: inline-flex; flex: none; }
.tick-delivered, .tick-read { color: var(--mesh); }
.tick-failed { color: var(--danger); }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); flex: none; align-self: stretch; justify-content: center; }
.chat-row__time { color: var(--ink-muted); font: var(--footnote-weight) var(--footnote-size) / var(--footnote-line) var(--footnote-family); }
.chat-row__time--new { color: var(--mesh); font-weight: var(--footnote-strong-weight); }
.chat-row .badge { min-inline-size: var(--badge-line); padding-inline: var(--space-1-half); font-weight: var(--badge-weight); }
.badge.quiet { background: var(--surface-sunken); color: var(--ink-muted); }

/* A row's "Chat actions": shown on the row under the pointer or with focus (board chats-row-menu). */
.row-with-menu { position: relative; }
.row-more {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--space-2);
  transform: translateY(-50%);
  background: var(--surface-raised);
  color: var(--mesh);
  opacity: 0;
}
.row-with-menu:hover .chat-row, .row-with-menu:focus-within .chat-row, .row-with-menu--open .chat-row {
  background: var(--surface-sunken);
  padding-inline-end: calc(var(--icon-button) + var(--space-3));
}
.row-with-menu:hover .row-more, .row-more:focus-visible, .row-more[aria-expanded="true"] { opacity: 1; }
.row-more:hover { background: var(--surface-raised); }

/* The row menu: a popover under the row's button, each item its words then its drawing. */
.chat-menu { inset-block-start: calc(100% - var(--space-2)); inset-inline-end: var(--space-2); }
.chat-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: none;
  border-block-end: var(--stroke-hairline) solid var(--line);
  background: none;
  color: var(--ink);
  text-align: start;
  font: var(--body-weight) var(--body-size) / var(--body-line) var(--body-family);
}
.chat-menu__item:last-child { border-block-end: 0; }
.chat-menu__item:hover, .chat-menu__item:focus-visible { background: var(--surface-sunken); }
.chat-menu__item .icon { flex: none; color: var(--ink-muted); }
.chat-menu__item--danger, .chat-menu__item--danger .icon { color: var(--danger); }

/* The toast's drawing. */
.chat-toast > .icon { flex: none; }

/* An empty list (boards chats-first-run, chats-no-unread, chats-unavailable, new-chat-empty). */
.chat-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-6);
  text-align: center;
}
.chat-empty--top { flex: none; justify-content: flex-start; padding-block-start: var(--space-6); }
.chat-empty__icon {
  display: grid;
  place-items: center;
  inline-size: calc(2 * var(--space-6));
  block-size: calc(2 * var(--space-6));
  margin: var(--space-3) 0 var(--space-3-half);
  border-radius: var(--radius-pill);
  background: var(--mesh-tint);
  color: var(--mesh);
  box-shadow: 0 0 0 var(--space-3) color-mix(in srgb, var(--mesh-tint) 40%, transparent);
}
.chat-empty__title { margin: 0; font: var(--title-condensed-weight) var(--title-condensed-size) / var(--title-condensed-line) var(--title-condensed-family); }
.chat-empty__text { margin: 0; max-inline-size: 32ch; color: var(--ink-muted); font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }
.chat-empty__actions { display: flex; flex-direction: column; gap: var(--space-2); align-self: stretch; margin-block-start: var(--space-3); }

/* The list while it loads (board chats-loading): sunken bars where the rows will be. */
.chat-skeleton { display: flex; flex-direction: column; gap: var(--space-half); padding-inline: var(--space-2); }
.chat-skeleton__row { display: flex; align-items: center; gap: var(--space-3); min-block-size: var(--avatar-lg); padding: var(--space-2-half) var(--space-3); }
.chat-skeleton__disc, .chat-skeleton__bar { display: block; border-radius: var(--radius-pill); background: var(--surface-sunken); }
.chat-skeleton__disc { inline-size: var(--avatar-row); block-size: var(--avatar-row); flex: none; }
.chat-skeleton__lines { display: flex; flex-direction: column; gap: var(--space-2-half); flex: 1 1 auto; min-inline-size: 0; }
.chat-skeleton__bar { inline-size: 40%; block-size: var(--space-3-half); }
.chat-skeleton__bar--sub { inline-size: 70%; block-size: var(--space-3); }
.chat-skeleton__row:nth-child(3n + 2) .chat-skeleton__bar { inline-size: 30%; }
.chat-skeleton__row:nth-child(3n + 2) .chat-skeleton__bar--sub { inline-size: 60%; }
.chat-skeleton__row:nth-child(3n) .chat-skeleton__bar { inline-size: 46%; }
.chat-skeleton__row:nth-child(3n) .chat-skeleton__bar--sub { inline-size: 76%; }

.list-end { height: 1px; }

/* New chat (boards new-chat, new-chat-empty): Cancel at the start, the title and its count centred; the search
   field; "Invite by link" as a grouped row; the people as disc rows. */
.new-chat { overflow: hidden; background: var(--surface); }
.new-chat__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-block-size: var(--top-bar);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  background: var(--surface-raised);
  border-block-end: var(--stroke-hairline) solid var(--line);
}
.new-chat__cancel { justify-self: start; min-block-size: var(--icon-button); }
.new-chat__title { min-inline-size: 0; text-align: center; }
.new-chat__title > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-block-size: var(--compact);
  margin: var(--space-2) var(--space-4) var(--space-2-half);
  padding-inline: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--ink-muted);
}
.search-field input {
  flex: 1;
  min-inline-size: 0;
  border: none;
  background: none;
  color: var(--ink);
  font: var(--body-weight) var(--body-size) / var(--body-line) var(--body-family);
}
.search-field input::placeholder { color: var(--ink-muted); }
.search-field input:focus-visible { outline: none; }
.search-field:focus-within { color: var(--ink); box-shadow: inset 0 0 0 var(--stroke-regular) var(--mesh); }
.new-chat__scroll { display: flex; flex-direction: column; gap: var(--space-2); flex: 1 1 auto; min-block-size: 0; overflow-y: auto; }
.new-chat__scroll > .chat-rows { flex: none; overflow: visible; }
.new-chat__group {
  flex: none;
  margin-inline: var(--space-4);
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  box-shadow: 0 0 0 var(--stroke-hairline) color-mix(in srgb, var(--line) 55%, transparent);
}
.new-chat__invite {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  inline-size: 100%;
  min-block-size: var(--row-min);
  padding: var(--space-3) var(--space-4);
  border: none;
  background: none;
  color: var(--ink);
  text-align: start;
}
.new-chat__invite:hover { background: var(--surface-sunken); }
.new-chat__tile {
  display: grid;
  place-items: center;
  inline-size: var(--avatar-xs);
  block-size: var(--avatar-xs);
  flex: none;
  border-radius: var(--radius-tile);
  background: var(--mesh-tint);
  color: var(--mesh);
}
.new-chat__chev { display: inline-flex; flex: none; color: var(--ink-muted); }
.new-chat__person { gap: var(--space-3); min-block-size: var(--row-min); padding: var(--space-2-half) var(--space-3); border-radius: var(--radius-menu); }
.new-chat__person .disc { font-size: var(--headline-size); }

/* The new-message card (board new-message-banner): .w-float below the chat head, the name over the preview, Dismiss.
   Its row and foot are this file's (the kit's .w-float__row, .w-float__foot). */
.message-float__row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-half);
  min-inline-size: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  text-align: start;
}
.message-float__name { font: var(--headline-weight) var(--headline-size) / var(--headline-line) var(--headline-family); }
.message-float__text {
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-muted);
  font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family);
}
.message-float__name, .message-float__text { max-inline-size: 100%; }
.message-float__foot { display: flex; gap: var(--space-2); }
.message-float__foot .w-btn { flex: 1 1 0; min-block-size: var(--icon-button); padding-inline: var(--space-3); }
