/* Conversation details follow the supplied Android reference. */
:root {
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --message-muted: #788277;
  --chat-bg: #f0ede5;
}

body { color: var(--text); }
.conversation { border: 0; }
.conversation-header {
  height: 68px;
  padding: 0 18px;
  gap: 10px;
  border: 0;
  z-index: 1;
}
.conversation-header .icon-button {
  width: 42px;
  height: 44px;
  border-radius: 50%;
}
.conversation-header .back-button { display: grid; width: 32px; }
.conversation-actions { gap: 3px; flex-shrink: 0; }
.conversation-actions svg { width: 23px; height: 23px; stroke-width: 1.9; }
.contact-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}
.contact-avatar .avatar { width: 40px; height: 40px; }
.contact-avatar.has-status { border: 2px solid #20c56a; padding: 2px; }
.contact-avatar.has-status .avatar { width: 36px; height: 36px; }
.contact-info { overflow: hidden; text-align: left; }
.contact-info strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
}
.message-scroll {
  min-height: 0;
  flex: 1 1 0;
  gap: 0;
  padding: 18px clamp(20px, 5vw, 76px) 14px;
  background-color: var(--chat-bg);
  background-image: url('chat-wallpaper.svg');
  background-size: 280px 280px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: auto;
}
.date-chip, .encryption, .message { flex-shrink: 0; }
.date-chip {
  margin: 0 0 14px;
  padding: 6px 12px;
  background: #fffdf9eb;
  border-radius: 9px;
  color: #687369;
  font-size: 11px;
  line-height: 16px;
}
.encryption {
  max-width: 340px;
  margin: 0 auto 18px;
  padding: 8px 13px;
  font-size: 10px;
  line-height: 1.65;
  background: #fff5cce8;
}
.message {
  --bubble-color: var(--bubble-in);
  --message-meta-width: 34px;
  align-self: flex-start;
  width: fit-content;
  min-width: 62px;
  max-width: min(86%, 520px);
  margin: 0;
  padding: 8px 11px 7px 12px;
  background: var(--bubble-color);
  border: 0;
  border-radius: 19px;
  box-shadow: 0 1px 1px #26342c15;
  color: var(--text);
  overflow-wrap: anywhere;
  position: relative;
  animation: none;
}
.message.sent {
  --bubble-color: var(--bubble-out);
  --message-meta-width: 58px;
  align-self: flex-end;
  background: var(--bubble-color);
  border-radius: 19px;
}
.message.group-start { margin-top: 12px; border-top-left-radius: 4px; }
.message.sent.group-start { border-top-left-radius: 19px; border-top-right-radius: 4px; }
.message.group-continuation { margin-top: 4px; }
.message.group-start::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 11px;
  height: 14px;
  background: var(--bubble-color);
  clip-path: path('M 11 0 H 1.5 Q -0.5 0 1 2 L 11 14 Z');
}
.message.sent.group-start::before { left: auto; right: -8px; transform: scaleX(-1); }
.message p {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: normal;
}
.message-meta-space {
  display: inline-block;
  width: calc(var(--message-meta-width) + 9px);
  height: 0;
  vertical-align: baseline;
}
.message-meta {
  position: absolute;
  right: 10px;
  bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 16px;
  min-width: var(--message-meta-width);
  font-size: 10.5px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--message-muted);
  white-space: nowrap;
  user-select: none;
}
.message .ticks, .chat-preview .ticks {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 16px;
  padding: 0;
  margin: 0;
  vertical-align: -3px;
  letter-spacing: 0;
  color: #38a9dc;
}
.ticks svg { width: 20px; height: 16px; stroke-width: 1.85; }
.ticks.local { color: #84938a; }
.ticks.local svg { width: 13px; height: 13px; }
.message.has-photo { padding: 4px; }
.message.has-photo p { padding: 5px 7px 3px 8px; }
.message-photo {
  width: 264px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 700 / 480;
  object-fit: cover;
  border-radius: 15px;
  display: block;
  margin: 0;
}
.message.has-photo.group-start .message-photo { border-top-left-radius: 3px; }
.message.has-photo.sent.group-start .message-photo { border-top-left-radius: 15px; border-top-right-radius: 3px; }
.message.has-photo:not(:has(p)) { padding-bottom: 24px; }
.message-sender { display: block; color: #15806b; font-size: 12px; font-weight: 600; margin: 0 0 3px; }
.message-reply { margin: 0 0 7px; }
.composer {
  gap: 7px;
  padding: 7px 8px max(9px, env(safe-area-inset-bottom));
  background-color: var(--chat-bg);
  background-image: url('chat-wallpaper.svg');
  background-size: 280px 280px;
  align-items: flex-end;
  border: 0;
}
.compose-box {
  min-width: 0;
  min-height: 52px;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 28px;
  align-items: flex-end;
  box-shadow: 0 1px 2px #26342c0a;
}
.compose-box .icon-button { width: 34px; height: 44px; flex-shrink: 0; color: #737a80; }
.compose-box .icon-button svg { width: 24px; height: 24px; }
.compose-box textarea {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 44px;
  max-height: 140px;
  margin: 0;
  padding: 11px 3px 9px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 24px;
  scrollbar-width: thin;
}
.compose-box textarea::placeholder { color: #8a8e91; }
.compose-box.is-writing [data-action='camera'] { display: none; }
.send-button { width: 52px; height: 52px; background: #1ba664; box-shadow: none; }
.send-button svg { width: 25px; height: 25px; }
.send-button.is-send svg { width: 24px; height: 24px; margin-left: 2px; }
.send-button:active { transform: scale(.94); }
.message-photo-button { display: block; max-width: 100%; border-radius: inherit; }
.photo-viewer { width: min(760px, 100%); background: #14201a; color: #fff; }
.photo-viewer img { width: 100%; height: auto; border-radius: 8px; display: block; }
body.dark {
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --message-muted: #a6b7ae;
  --chat-bg: #0b141a;
}
body.dark .message.sent { background: var(--bubble-out); }
body.dark .date-chip { background: #233138; color: #becac5; }
body.dark .message-sender { color: #67d3b4; }
body.dark .compose-box { background: #202c33; }
body.dark .message-reply { background: #ffffff12; color: #b5c6bd; }
body.dark .message-reply strong { color: #67d3b4; }
body.dark .compose-box .icon-button { color: #a4b3ab; }
@media (max-width: 800px) {
  .conversation-header { height: 64px; gap: 6px; padding: 0 7px; }
  .conversation-header .back-button { width: 30px; }
  .conversation-actions { gap: 0; }
  .conversation-header .conversation-actions .icon-button { width: 37px; }
  .contact-info strong { font-size: 16px; }
  .message-scroll { padding: 14px 18px 12px; scrollbar-width: none; }
  .message { max-width: 87%; }
  .composer { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 360px) {
  .conversation-header { gap: 4px; padding: 0 4px; }
  .conversation-header .conversation-actions .icon-button { width: 33px; }
  .contact-info strong { font-size: 15px; }
  .message-scroll { padding-left: 15px; padding-right: 15px; }
  .message { max-width: 88%; }
  .compose-box { padding-left: 4px; padding-right: 4px; gap: 1px; }
  .compose-box .icon-button { width: 29px; }
  .send-button { width: 50px; height: 52px; }
}
