/* The header's live chat switch: a little track with a knob, mint while
   you're around for chat. It changes state without moving, on purpose. */
.availability__switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.8em 0.35em 0.5em;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.9rem/1.2 var(--font-display);
  white-space: nowrap;
  cursor: pointer;
}

.availability__switch:hover { background: var(--paper); }

.availability__track {
  position: relative;
  flex: none;
  width: 2rem;
  height: 1.15rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper-deep);
}

.availability__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.15rem - 8px);
  height: calc(1.15rem - 8px);
  border-radius: 50%;
  background: var(--ink);
}

.availability__switch--on,
.availability__switch--on:hover { border-color: var(--ink); background: var(--mint-pale); }
.availability__switch--on .availability__track { background: var(--mint); }
.availability__switch--on .availability__track::after { left: auto; right: 2px; background: var(--surface); }

@media (max-width: 720px) {
  .availability { margin-left: auto; }
  .availability + .account-menu { margin-left: 0; }
}

/* Live chats waiting for an answer, under the header for whoever's around. */
.waiting-chats:has(.waiting-chats__inner) {
  background: var(--coral-pale);
  border-bottom: 2px solid var(--line);
}

.waiting-chats__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.55rem 16px;
}

.waiting-chats__label {
  padding: 0.1em 0.7em;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--coral);
  color: var(--on-accent);
  font: 700 0.8rem/1.4 var(--font-display);
  white-space: nowrap;
}

.waiting-chats__list {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.waiting-chats__list a { color: var(--ink); }

.pill--chat { background: var(--accent-pale); color: var(--ink); }

/* Who's around to chat: their faces, overlapping a little, and their names. */
.chat-team {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.public__card .chat-team { justify-content: center; text-align: left; }

.chat-team__faces { display: flex; flex: none; }
.chat-team__faces :is(.figure, .portrait) {
  display: block;
  width: 2.6rem;
  height: 2.6rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
}
.chat-team__faces > * + * { margin-left: -0.7rem; }

/* The contact form's offer to chat instead, while someone's around. */
.public__card .sheet.chat-invite { text-align: center; }
.chat-invite .chat-team { margin-bottom: 0.5rem; }

/* A visitor's live chat: the conversation, with the message box held at the
   bottom of the screen on a solid background. */
.chat {
  display: flex;
  flex-direction: column;
  max-width: 680px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 1.5rem 16px 0;
}

.chat__head { border-bottom: 2px dashed var(--line); }
.chat__head h1 { margin-bottom: 0.4rem; }

.chat .thread { flex: 1; align-content: start; }

.chat__resolved { text-align: center; }

.chat__composer {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 1rem;
  border-top: 2px solid var(--line);
  background: var(--paper);
}

.chat__composer p { margin: 0.5rem 0 0; }

.chat__form { display: flex; align-items: flex-end; gap: 0.6rem; }
.chat__form .textarea { min-height: 3.2rem; max-height: 10rem; resize: none; field-sizing: content; }
