.modal-backdrop.crew-chat-viewport {
  position: fixed;
  inset: var(--crew-viewport-top, 0px) 0 auto;
  height: var(--crew-viewport-height, 100vh);
  height: var(--crew-viewport-height, 100dvh);
  display: flex;
  padding: 0;
  overflow: hidden;
}

.crew-chat-viewport .sheet.crew-chat-sheet {
  display: flex;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #f2f7fc;
}

.crew-chat {
  --chat-blue: #194970;
  --chat-ink: #162f45;
  --chat-line: #d0dfec;
  --chat-yellow: #ffe18a;
  --chat-gutter: max(14px, calc((100% - 740px) / 2), env(safe-area-inset-left), env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  color: var(--chat-ink);
}

.crew-chat-inner { max-width: 740px; margin-inline: auto; }
.crew-chat-header {
  flex: none;
  background: #e1effa;
  padding: max(10px, env(safe-area-inset-top)) var(--chat-gutter) 12px;
  border-bottom: 1px solid var(--chat-line);
}

.crew-chat-heading {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.crew-chat-heading h2 {
  margin: 0;
  color: var(--chat-ink);
  font-family: inherit;
  font-size: clamp(17px, 4.6vw, 25px);
  font-weight: 800;
  line-height: 1.12;
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.crew-chat button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  box-shadow: none;
}

.crew-chat .crew-chat-icon,
.crew-chat .crew-chat-info-button {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 0;
  color: var(--chat-blue);
}

.crew-chat .crew-chat-icon {
  width: 40px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  font-size: 20px;
}

.crew-chat .crew-chat-info-button {
  padding: 0 12px;
  border-radius: 20px;
  background: var(--chat-yellow);
  color: #3c3117;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.crew-chat .crew-chat-info-button[aria-expanded="true"] { background: #ffcf5d; }
.crew-chat button:focus-visible, .crew-chat textarea:focus-visible {
  outline: 2px solid var(--chat-blue);
  outline-offset: 2px;
}

.crew-chat-byline { display: flex; align-items: center; gap: 8px; margin: 7px 0 0 3px; }
.crew-chat-byline .crew-avatar { width: 34px; height: 34px; flex-basis: 34px; }
.crew-chat-facts { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; color: #34556e; font-size: 12px; }
.crew-chat-facts strong { padding: 2px 7px; border-radius: 20px; background: #fff4cd; color: #544111; }
.crew-chat-host-name, .crew-chat p.crew-chat-direct { margin: 2px 0 0; color: #34556e; font-size: 12px; overflow-wrap: anywhere; }
.crew-chat p.crew-chat-direct { margin-left: 49px; }

.crew-chat-info-panel {
  flex: none;
  max-height: 35%;
  overflow: auto;
  padding-inline: var(--chat-gutter);
  background: #fff;
  border-bottom: 1px solid var(--chat-line);
}
.crew-chat-info-panel[hidden] { display: none; }
.crew-chat-info-panel p.crew-chat-country { margin: 10px 0 0; font-size: 13px; font-weight: 800; color: var(--chat-blue); }
.crew-chat-info-panel #closeCrewGroup { margin-bottom: 10px; }
.crew-chat-host, .crew-chat-about { border-bottom: 1px solid #e2eaf2; }
.crew-chat-host summary, .crew-chat-about summary { cursor: pointer; padding: 10px 0; font-weight: 700; }
.crew-chat-host summary { display: flex; align-items: center; gap: 10px; list-style: none; }
.crew-chat-host summary::-webkit-details-marker { display: none; }
.crew-host-profile-label { margin-left: auto; font-size: 13px; color: var(--chat-blue); }
.crew-chat-about-body, .crew-host-bio { padding-bottom: 10px; }
.crew-host-bio p, .crew-chat-about-body p { margin: 5px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.crew-chat .crew-chat-stream.inbox-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 14px var(--chat-gutter);
  background: #f2f7fc;
  border: 0;
}
.crew-chat-stream > * { flex-shrink: 0; }
.crew-chat-empty { margin: auto; text-align: center; color: #45627b; }
.crew-chat-empty p { margin: 4px 0; }
.crew-message { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.crew-message-own { flex-direction: row-reverse; }
.crew-message-content { min-width: 0; max-width: min(calc(100% - 46px), 560px); }
.crew-message-body { min-width: 0; padding: 9px 12px; background: #fff; border: 1px solid var(--chat-line); border-radius: 5px 16px 16px; }
.crew-message-own .crew-message-body { background: #dbeefa; border-radius: 16px 5px 16px 16px; }
.crew-message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; color: #34556e; font-size: 12px; }
.crew-message-meta time { font-size: 11px; }
.crew-chat .crew-message-body p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--chat-ink); }
.crew-chat .crew-reply-action { display: block; min-height: 30px; padding: 3px 8px; border: 0; background: transparent; color: var(--chat-blue); font-size: 12px; font-weight: 800; }
.crew-chat .crew-message-own .crew-reply-action { margin-left: auto; }
.crew-chat-day { text-align: center; color: #51411e; font-size: 11px; font-weight: 800; }
.crew-chat-day span { display: inline-block; padding: 4px 9px; border-radius: 20px; background: #fff0bf; }
.crew-join-notice { display: flex; align-items: center; justify-content: center; gap: 7px; color: #34556e; font-size: 12px; text-align: center; }
.crew-join-notice .crew-avatar { width: 25px; height: 25px; flex-basis: 25px; }

.crew-chat-dock { flex: none; background: #fff; border-top: 1px solid var(--chat-line); padding: 8px var(--chat-gutter) max(9px, env(safe-area-inset-bottom)); }
.crew-chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: end; }
.crew-chat-compose textarea {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 112px;
  resize: none;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--chat-line);
  border-radius: 22px;
  background: #f2f7fc;
  color: var(--chat-ink);
  font-size: 16px;
  line-height: 20px;
}
.crew-chat .crew-send { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--chat-yellow); color: #26364a; }
.crew-chat .crew-send:disabled { opacity: 1; background: #e5eff7; color: #49647b; }
.crew-chat p.crew-chat-privacy, .crew-chat p.crew-chat-closed { margin: 0; padding: 9px 0; font-size: 12px; }
.crew-chat p.crew-chat-closed { padding-inline: var(--chat-gutter); }
.crew-reply-quote { display: grid; gap: 1px; min-width: 0; margin-top: 5px; padding: 5px 8px; border-left: 3px solid #ba861a; border-radius: 4px; background: #fff4ce; color: #423716; font-size: 12px; }
.crew-reply-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-reply-preview { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.crew-reply-preview .crew-reply-quote { flex: 1; margin: 0; }
