/* Contact info, Starred messages, the safety code, invite links and pairing, as the canvas's contact-*, starred*,
   safety-code*, invite-* and paired boards draw them (the kit's ml-group, ml-row, ml-tile, ml-switch, ml-actions,
   ml-statechip, ml-banner, ml-card, k-safety, written here as ct-*: the frame has none of them yet).
   Contact info and Starred stand in the side pane (380 wide) beside the conversation, or in the main pane, one
   column of the page's width, when no conversation is beneath them: both are written here.
   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. */

/* A view that fills its pane: the head, then what scrolls. */
.ct-view { display: flex; flex-direction: column; min-block-size: 0; overflow: hidden; background: var(--surface); }
.ct-view > .w-head { flex: none; }
.ct-head--back { padding-inline-start: var(--space-2); }
.ct-scroll {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}
.ct-scroll > * { flex: none; }
/* In the main pane: one column of the page's width. */
.w-main .ct-scroll > *, .w-main .ct-view > .ct-banner { inline-size: 100%; max-inline-size: var(--w-page); margin-inline: auto; }

/* A text only a screen reader reads. */
.ct-sr {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Buttons the kit draws round (ml-iconbtn). */
.ct-iconbtn {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: var(--icon-button);
  block-size: var(--icon-button);
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--mesh);
}
.ct-iconbtn:hover { background: var(--surface-sunken); }

/* The person at the top: their face, their name, their About, how sure you are it is them. */
.ct-hero { padding-block-start: var(--space-2); display: flex; flex-direction: column; align-items: center; gap: var(--space-1-half); text-align: center; }
.ct-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  inline-size: var(--avatar-hero);
  block-size: var(--avatar-hero);
  margin-block-end: var(--space-1-half);
  border-radius: var(--radius-pill);
  /* The person's colour comes inline from the record's tint (#2135); this is the face before it is drawn. */
  background: var(--surface-sunken);
  color: var(--ink-muted);
  font: var(--display-condensed-weight) var(--display-condensed-size) / 1 var(--font-sans);
  user-select: none;
}
.ct-avatar--sm { inline-size: var(--call-avatar-sm); block-size: var(--call-avatar-sm); margin-block-end: var(--space-1); font-size: var(--large-title-size); }
/* They are nearby now: the kit's reach dot. */
.ct-avatar--reach::after {
  content: "";
  position: absolute;
  inset-inline-end: var(--space-1-half);
  inset-block-end: var(--space-1-half);
  inline-size: var(--space-4-half);
  block-size: var(--space-4-half);
  border-radius: var(--radius-pill);
  background: var(--mesh);
  border: var(--stroke-regular) solid var(--surface-raised);
}
.ct-name {
  display: flex;
  align-items: center;
  gap: var(--space-1-half);
  margin: 0;
  font: var(--brand-weight) var(--brand-size) / var(--brand-line) var(--brand-family);
  letter-spacing: var(--brand-tracking);
  overflow-wrap: anywhere;
}
.ct-name .icon { color: var(--mesh); }
.ct-about { margin: 0; font: italic var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); color: var(--ink-muted); }
.ct-trustlink {
  padding: 0 var(--space-1);
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-muted);
  font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family);
}
.ct-trustlink strong { color: var(--mesh); font-weight: var(--callout-strong-weight); }

/* A state chip (ml-statechip). */
.ct-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  block-size: var(--state-chip);
  padding: 0 var(--space-2-half);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--mesh-tint);
  color: var(--ink);
  font: var(--metric-weight) var(--footnote-size) / var(--footnote-line) var(--font-sans);
  white-space: nowrap;
}
.ct-chip--danger { background: var(--danger-tint); color: var(--danger); }
.ct-chip--plain { background: var(--surface-sunken); }
.ct-chip--centre { align-self: center; }

/* The actions under the person (ml-actions): equal tiles in a row. */
.ct-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-2); }
.ct-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-half);
  min-block-size: var(--avatar-lg);
  padding: var(--space-2);
  border: none;
  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);
  color: var(--mesh);
  font: var(--footnote-strong-weight) var(--footnote-strong-size) / var(--footnote-strong-line) var(--footnote-strong-family);
  text-align: center;
}
.ct-action:hover { background: var(--surface-sunken); }

/* A list in a card (ml-group, ml-row). */
.ct-section { margin: var(--space-1) 0 calc(-1 * var(--space-1-half)); padding-inline: var(--space-1); }
.ct-label {
  margin: 0;
  font: var(--label-mono-weight) var(--label-mono-size) / var(--label-mono-line) var(--label-mono-family);
  letter-spacing: var(--label-mono-tracking);
  text-transform: uppercase;
  color: var(--ink-muted);
}
.ct-group {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  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);
}
.ct-group > li { display: contents; }
.ct-row {
  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;
  border-block-end: var(--stroke-hairline) solid color-mix(in srgb, var(--line) 70%, transparent);
  background: none;
  color: var(--ink);
  text-align: start;
  font: var(--body-weight) var(--body-size) / var(--headline-line) var(--body-family);
}
.ct-group > :last-child, .ct-group > :last-child > .ct-row { border-block-end: none; }
button.ct-row:hover, label.ct-row:hover { background: var(--surface-sunken); }
label.ct-row { cursor: pointer; }
.ct-row__body { flex: 1 1 auto; min-inline-size: 0; display: flex; flex-direction: column; gap: var(--space-half); }
.ct-row__title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-row__title--strong { font-weight: var(--headline-weight); }
.ct-row__sub { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink-muted); font: var(--footnote-weight) var(--footnote-size) / var(--footnote-line) var(--footnote-family); }
.ct-row__value { flex: none; color: var(--ink-muted); }
.ct-row--danger { color: var(--danger); font-weight: var(--headline-weight); }
.ct-row--strong { font-weight: var(--headline-weight); }
.ct-row--missed .ct-row__title { color: var(--danger); }
.ct-row .ct-check { color: var(--mesh); }
.ct-chev { flex: none; color: var(--ink-muted); }
.ct-chev:dir(rtl) { transform: scaleX(-1); }
.ct-tile {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: calc(2 * var(--space-4));
  block-size: calc(2 * var(--space-4));
  border-radius: var(--radius-tile);
  background: var(--mesh-tint);
  color: var(--mesh);
}
.ct-tile--danger { background: var(--danger-tint); color: var(--danger); }
.ct-tile--plain { background: var(--surface-sunken); color: var(--ink-muted); }

/* A switch (ml-switch), on a checkbox. */
.ct-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  inline-size: calc(var(--space-7) - 3 * var(--space-1));
  block-size: calc(2 * var(--space-4));
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 var(--stroke-regular) var(--line-strong);
  cursor: pointer;
}
.ct-switch::after {
  content: "";
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  inline-size: var(--space-4);
  block-size: var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  transition: all var(--duration-fast) ease-out;
}
.ct-switch:checked { background: var(--mesh); box-shadow: none; }
.ct-switch:checked::after {
  inset-block-start: var(--space-1);
  inset-inline-start: var(--space-5);
  inline-size: var(--space-5);
  block-size: var(--space-5);
  background: var(--on-mesh);
}

/* A banner at the pane's top (ml-banner): their safety code changed. */
.ct-banner {
  display: flex;
  align-items: flex-start;
  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(--caution-tint);
  color: var(--ink);
  font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family);
}
.ct-banner > .icon { flex: none; color: var(--caution); }
.ct-banner__body { flex: 1 1 auto; min-inline-size: 0; }
.ct-banner__title { display: block; font-weight: var(--callout-strong-weight); }
.ct-banner__action {
  flex: none;
  align-self: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--caution);
  font: var(--callout-strong-weight) var(--callout-size) / var(--callout-line) var(--callout-family);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ct-banner--danger { margin: 0; background: var(--danger-tint); }
.ct-banner--danger > .icon { color: var(--danger); }

/* Starred messages: a row opens the chat at the message; the star unstars it. */
.ct-starred { align-items: flex-start; padding-inline-end: var(--space-2); }
.ct-starred__open { flex: 1 1 auto; min-inline-size: 0; display: flex; flex-direction: column; gap: var(--space-half); padding: 0; border: none; background: none; color: inherit; text-align: start; font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }
.ct-starred__line { display: flex; justify-content: space-between; gap: var(--space-2); }
.ct-starred__who { font-weight: var(--callout-strong-weight); }
.ct-starred__when { flex: none; color: var(--ink-muted); font: var(--footnote-weight) var(--footnote-size) / var(--footnote-line) var(--footnote-family); }
.ct-starred__text { overflow-wrap: anywhere; }
.ct-starred .ct-iconbtn { margin-block-start: calc(-1 * var(--space-2)); }
.ct-more { align-self: center; }
.ct-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;
}
.ct-empty h2 { margin: 0; font: var(--title-condensed-weight) var(--title-condensed-size) / var(--title-condensed-line) var(--title-condensed-family); }
.ct-empty p { margin: 0; max-inline-size: 32ch; color: var(--ink-muted); font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }
.ct-note { margin: 0; padding: var(--space-5) var(--space-1); color: var(--ink-muted); font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }

/* Faces side by side (paired, a link added, the safety code): each in the person's colour, from the record (#2135). */
.ct-faces { display: flex; align-items: center; justify-content: center; gap: var(--space-2-half); }
.ct-faces--code { gap: var(--space-3-half); padding-block: var(--space-1); }
.ct-face { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.ct-face__disc {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: var(--avatar-lg);
  block-size: var(--avatar-lg);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-muted);
  font: var(--headline-weight) var(--title-size) / 1 var(--font-sans);
  user-select: none;
}
.ct-face__seal {
  position: absolute;
  inset-inline-end: calc(-1 * var(--space-1));
  inset-block-start: calc(-1 * var(--space-1));
  display: grid;
  place-items: center;
  inline-size: var(--space-5);
  block-size: var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--mesh);
  color: var(--on-mesh);
  border: var(--stroke-regular) solid var(--surface-raised);
}
.ct-face__name { font: var(--footnote-strong-weight) var(--footnote-strong-size) / var(--footnote-strong-line) var(--footnote-strong-family); }
.ct-join { flex: none; inline-size: var(--space-4-half); block-size: var(--space-4-half); border-radius: var(--radius-pill); background: var(--mesh); }
.ct-mark { color: var(--mesh); }
.ct-mark--danger { color: var(--danger); }

/* The safety code: six groups of five digits in three columns (k-safety). */
.ct-dialog__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.w-dialog .ct-dialog__top .ct-iconbtn { margin-inline-end: calc(-1 * var(--space-2)); }
.w-dialog h3.ct-label { margin-block-start: var(--space-1); }
.ct-code {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: var(--space-1-half) var(--space-5);
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-card);
  background: var(--surface-sunken);
  font: var(--safety-code-weight) var(--safety-code-size) / var(--safety-code-line) var(--safety-code-family);
  letter-spacing: var(--safety-code-tracking);
  font-variant-numeric: tabular-nums;
}
.ct-code--verified { box-shadow: inset 0 0 0 var(--stroke-regular) var(--mesh); }
.ct-code--mismatch { box-shadow: inset 0 0 0 var(--stroke-regular) var(--danger); color: var(--ink-muted); }
/* No digits yet (both keys are not known): a bar in each group's place. */
.ct-code__wait { display: block; inline-size: calc(4 * var(--space-4)); block-size: var(--space-2); margin-block: var(--space-2); border-radius: var(--radius-pill); background: var(--line); }

/* The invite pages and Paired: a page in the main pane. */
.ct-page { gap: var(--space-3-half); }
.ct-page--centre { justify-content: center; padding-block-end: calc(4 * var(--space-5)); }
.ct-page--centre > * { max-inline-size: 480px; }
.ct-centre { display: flex; justify-content: center; align-items: center; gap: var(--space-2); text-align: center; }
.ct-text { margin: 0; text-align: center; font: var(--body-weight) var(--body-size) / var(--body-line) var(--body-family); }
.ct-text--muted { color: var(--ink-muted); }
.ct-callout { margin: 0; text-align: center; color: var(--ink-muted); font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }
.ct-callout--gap { margin-block-start: var(--space-3); }
.ct-display {
  margin: 0;
  text-align: center;
  font: var(--display-condensed-weight) var(--display-condensed-size) / var(--display-condensed-line) var(--display-condensed-family);
  letter-spacing: var(--display-condensed-tracking);
}
.ct-title { margin: 0; text-align: center; font: var(--title-condensed-weight) var(--title-condensed-size) / var(--title-condensed-line) var(--title-condensed-family); }
.ct-rule { block-size: var(--stroke-hairline); margin-block: var(--space-3); background: var(--line); }
.ct-disc {
  display: grid;
  place-items: center;
  inline-size: var(--avatar-hero);
  block-size: var(--avatar-hero);
  border-radius: var(--radius-pill);
  background: var(--mesh-tint);
  color: var(--mesh);
}
.ct-disc--danger { background: var(--danger-tint); color: var(--danger); }

/* A card of my links (ml-card): a live link in its box with Copy, Share and Cancel link; what became of the others. */
.ct-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2-half);
  margin: 0;
  padding: var(--space-4);
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 var(--stroke-hairline) var(--line);
}
.ct-card--live { gap: var(--space-3); }
.ct-card__line { display: flex; align-items: center; gap: var(--space-2); font: var(--callout-weight) var(--callout-size) / var(--callout-line) var(--callout-family); }
.ct-card__line + .ct-card__line { padding-block-start: var(--space-2-half); border-block-start: var(--stroke-hairline) solid var(--line); }
.ct-card__line--muted { color: var(--ink-muted); }
.ct-card__line .icon { flex: none; }
.ct-card__done .icon { color: var(--mesh); }
.ct-card__failed .icon { color: var(--danger); }
.ct-card__bar { display: flex; align-items: center; gap: var(--space-2); }
.ct-card__bar > .ct-copied { margin-inline-start: auto; }
.ct-copied { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--mesh); font: var(--footnote-strong-weight) var(--footnote-strong-size) / var(--footnote-strong-line) var(--footnote-strong-family); }
.ct-spin {
  flex: none;
  inline-size: calc(var(--space-5) + var(--space-1));
  block-size: calc(var(--space-5) + var(--space-1));
  border-radius: var(--radius-pill);
  border: 3px solid var(--mesh-tint);
  border-block-start-color: var(--mesh);
}
.ct-spin--lg { inline-size: calc(2 * var(--space-5)); block-size: calc(2 * var(--space-5)); border-width: var(--space-1); }
@media (prefers-reduced-motion: no-preference) {
  .ct-spin { animation: ct-spin 0.9s linear infinite; }
  @keyframes ct-spin { to { transform: rotate(1turn); } }
}

/* "Have a link? Paste it here": the field and Open on one line, the refusal under it. */
.ct-paste { display: flex; flex-direction: column; gap: var(--space-1-half); }
.ct-paste__row { display: flex; align-items: center; gap: var(--space-2); }
.ct-paste__row .w-input { flex: 1 1 auto; min-inline-size: 0; font: var(--metric-weight) var(--callout-size) / var(--callout-line) var(--font-mono); }
.ct-paste .w-hint { margin: 0; }

/* The timer's choices in its dialog (board contact-timer): radio rows on a sunken card. */
.ct-group--sunken { background: var(--surface-sunken); box-shadow: none; }
.ct-opt { min-block-size: var(--icon-button); padding-block: 0; }
.ct-radio {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: var(--space-5);
  block-size: var(--space-5);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 var(--stroke-regular) var(--line-strong);
}
.ct-radio.on { box-shadow: inset 0 0 0 var(--stroke-regular) var(--mesh); }
.ct-radio.on::after { content: ""; inline-size: var(--space-3); block-size: var(--space-3); border-radius: var(--radius-pill); background: var(--mesh); }
.w-linkbox > .icon { flex: none; color: var(--ink-muted); }
