/* Scoped chat media, upload queue, and gallery surfaces. */
.chat-screen { position: relative; }
.chat-message-items { display: contents; }
.full-chat-list { overflow-anchor: none; overscroll-behavior: contain; }
.chat-screen [hidden], .group-media-browser [hidden] { display: none !important; }
.chat-earlier {
  justify-self: center;
  min-height: 40px;
  padding: 8px 16px;
  color: #6a7773;
  background: transparent;
  font-size: 13px;
}
.chat-page-status {
  padding: 8px 12px;
  color: #70553a;
  background: #fff6e5;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.chat-jump-latest {
  position: absolute;
  right: 12px;
  bottom: 78px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid #e7ebe9;
  border-radius: 6px;
  color: #079b76;
  background: #fff;
  box-shadow: 0 2px 8px #0000000a;
}
.chat-jump-latest svg { width: 18px; height: 18px; stroke: currentColor; transform: rotate(90deg); }
.chat-compose-shell { min-width: 0; max-height: min(65dvh, 480px); overflow-y: auto; overscroll-behavior: contain; }
.chat-composer, body.app-mode .chat-composer { display: flex; min-width: 0; }
.chat-composer .chat-input-slot { flex: 1; }
.chat-composer .chat-input-slot, .chat-composer input { min-width: 0; }
.chat-composer .chat-tool, body.app-mode .chat-composer .chat-tool { flex: 0 0 36px; width: 36px; min-width: 36px; height: 40px; }
.chat-composer .chat-send { flex-shrink: 0; min-width: 48px; padding-inline: 10px; }
.chat-composer .chat-send:disabled { opacity: 0.5; }
.chat-file-preview.chat-batch-preview {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
  padding: 10px 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: 0;
}
.chat-file-preview.chat-batch-preview.hidden { display: none; }
.chat-attachment-item {
  position: relative;
  display: grid;
  grid-template-rows: 64px 18px 16px;
  flex: 0 0 88px;
  width: 88px;
  min-width: 0;
  gap: 2px;
  color: #253330;
  font-size: 11px;
}
.chat-attachment-item > img, .chat-attachment-icon, .chat-attachment-item > [data-preview-audio] {
  display: grid;
  place-items: center;
  width: 88px;
  height: 64px;
  padding: 0;
  border-radius: 4px;
  background: #e9efed;
  object-fit: cover;
}
.chat-attachment-item audio { display: none; }
.chat-attachment-item svg { width: 24px; height: 24px; stroke: currentColor; }
.chat-attachment-item > [data-remove-attachment] {
  position: absolute;
  right: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 0 4px 0 4px;
  color: #fff;
  background: #222a;
}
.chat-attachment-item > [data-remove-attachment] svg { width: 18px; height: 18px; }
.chat-attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; }
.chat-attachment-item small { font-size: 10px; color: #6a7773; }
.chat-send-queue { max-height: 174px; overflow-y: auto; background: #fff; border-bottom: 1px solid #e7ebe9; }
.chat-send-queue.hidden { display: none; }
.chat-queue-item { display: flex; align-items: center; gap: 8px; min-height: 62px; padding: 8px 12px; }
.chat-queue-item + .chat-queue-item { border-top: 1px solid #e7ebe9; }
.chat-queue-icon { flex: 0 0 28px; color: #587669; }
.chat-queue-icon svg { width: 24px; height: 24px; stroke: currentColor; }
.chat-queue-meta { display: grid; gap: 3px; flex: 1; min-width: 0; }
.chat-queue-meta strong { font-size: 12px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-queue-meta small { font-size: 11px; color: #6a7773; overflow-wrap: anywhere; }
.chat-queue-meta progress { width: 100%; height: 4px; accent-color: #079b76; }
.chat-queue-item > button { flex: 0 0 36px; width: 36px; min-height: 40px; display: grid; place-items: center; padding: 0; color: #52665a; background: transparent; }
.chat-queue-item > button svg { width: 20px; height: 20px; stroke: currentColor; }
.message-stack.has-media { width: min(240px, 68vw); max-width: 100%; }
.chat-message-media { max-height: 280px; object-fit: contain; }
.chat-media-open { max-width: 240px; }
.chat-media-viewer-content { max-width: 100%; max-height: 100%; object-fit: contain; }
.group-media-entry { gap: 12px; min-height: 48px; width: 100%; }
.group-media-entry > svg { width: 22px; height: 22px; stroke: currentColor; flex-shrink: 0; }
.group-media-entry > span { flex: 1; text-align: left; }
.group-media-browser {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: var(--app-viewport-height, 100dvh);
  min-height: 0;
  color: #253330;
  background: #f7f9f8;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.group-media-browser header { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; min-height: 54px; padding: env(safe-area-inset-top, 0px) 8px 0; background: #fff; border-bottom: 1px solid #e7ebe9; }
.group-media-browser header strong { font-size: 16px; font-weight: 600; text-align: center; }
.group-media-browser header button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent; color: inherit; }
.group-media-browser header svg { width: 22px; height: 22px; stroke: currentColor; }
.group-media-tabs { display: flex; justify-content: center; padding: 8px 12px; gap: 8px; background: #fff; }
.group-media-tabs button { width: 88px; min-height: 40px; padding: 8px 12px; font-size: 14px; color: #6a7773; background: transparent; border-radius: 4px; }
.group-media-tabs button[aria-selected="true"] { color: #079b76; background: #e4f4ea; font-weight: 600; }
.group-media-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 4px 4px 24px; }
.group-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; max-width: 900px; margin: 0 auto; }
.group-media-tile { display: block; position: relative; aspect-ratio: 1; width: 100%; min-width: 0; min-height: 0; padding: 0; border-radius: 2px; overflow: hidden; background: #e5ede9; }
.group-media-tile > img, .group-media-placeholder { display: grid; place-items: center; width: 100%; height: 100%; object-fit: cover; }
.group-media-tile svg { width: 32px; height: 32px; stroke: currentColor; }
.group-media-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; color: #fff; border-radius: 50%; background: #2228; }
.group-media-play svg { width: 36px; height: 36px; }
.group-media-tile time { position: absolute; right: 0; bottom: 0; padding: 3px 5px; font-size: 10px; line-height: 14px; color: #fff; background: #2229; }
.group-media-status { padding: 20px 12px 8px; text-align: center; font-size: 13px; color: #6a7773; overflow-wrap: anywhere; }
.group-media-more { display: block; margin: 8px auto; min-height: 44px; padding: 10px 24px; color: #079b76; background: transparent; }
@media (max-width: 360px) {
  .chat-composer { gap: 3px; padding-inline: 5px; }
  .chat-composer .chat-tool, body.app-mode .chat-composer .chat-tool { flex-basis: 30px; width: 30px; min-width: 30px; }
  .chat-composer .chat-send { min-width: 44px; padding-inline: 7px; }
}
