/* Chat: room pages and the in-call panel. */
.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  font-size: 12px;
}
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 0 6px;
  outline: none;
}
.chat-more {
  display: block;
  margin: 4px auto 10px;
  font-size: 10px;
  color: var(--muted);
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.chat-more:hover { color: var(--text); background: #ffffff08; }
.chat-more[hidden] { display: none; }
.chat-empty {
  margin: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}
.chat-day {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 18px 6px;
  color: #777;
  font-size: 10px;
}
.chat-day::before,
.chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.chat-msg {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0 10px;
  padding: 6px 18px 4px;
  margin-top: 4px;
}
.chat-msg.grouped { margin-top: 0; padding-top: 1px; }
.chat-msg:hover,
.chat-msg:focus-within { background: #ffffff05; }
.chat-msg.flash { animation: chat-flash 1.2s ease-out; }
@keyframes chat-flash { from { background: #ffffff1c; } to { background: transparent; } }
.chat-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #909090;
  color: #171717;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
}
.chat-msg.grouped .chat-avatar { visibility: hidden; height: 0; }
.chat-msg.mine:not(.grouped) .chat-avatar { background: #d6d6d6; }
.chat-main { min-width: 0; }
.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 2px;
}
.chat-meta strong {
  font-size: 12px;
  font-weight: 600;
  color: #e2e2e2;
  text-transform: none;
}
.chat-meta time,
.chat-side-time { font-size: 9.5px; color: #767676; }
.chat-side-time {
  position: absolute;
  left: 0;
  top: 5px;
  width: 46px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 14px;
  opacity: 0;
}
.chat-compact .chat-side-time { width: 42px; }
.chat-msg.grouped:hover .chat-side-time { opacity: 1; }
.chat-tag {
  font-size: 9px;
  color: #a5a5a5;
  border: 1px solid #ffffff1f;
  border-radius: 4px;
  padding: 0 4px;
}
.chat-body {
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-transform: none;
}
.chat-body a { color: #b9cfe0; text-decoration: underline; text-decoration-color: #b9cfe066; text-underline-offset: 2px; }
.chat-body a:hover { text-decoration-color: currentColor; }
.chat-body code {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11px;
  background: #ffffff10;
  border: 1px solid #ffffff12;
  border-radius: 4px;
  padding: 0 4px;
}
.chat-jumbo { font-size: 28px; line-height: 1.25; }
.chat-deleted { color: #777; font-style: italic; text-transform: lowercase; }
.chat-edited { margin-left: 5px; font-size: 9.5px; color: #777; text-transform: lowercase; }

.chat-reply {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 1px 0 4px;
  padding: 0;
  color: #8c8c8c;
  font-size: 10.5px;
  text-align: left;
  text-transform: none;
}
.chat-reply svg { flex: none; width: 13px; height: 13px; transform: scaleY(-1); }
.chat-reply strong { font-weight: 600; color: #b0b0b0; flex: none; }
.chat-reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply:hover span { color: var(--text); }

.chat-preview {
  display: flex;
  flex-direction: column;
  width: min(100%, 360px);
  margin: 6px 0 2px;
  overflow: hidden;
  border: 1px solid #ffffff14;
  border-radius: 9px;
  background: #ffffff06;
  color: inherit;
  text-decoration: none;
  text-transform: none;
}
.chat-preview:hover { border-color: #ffffff2a; background: #ffffff0a; }
.chat-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1.91 / 1;
  object-fit: cover;
  background: #222;
  border-bottom: 1px solid #ffffff10;
}
.chat-preview strong {
  padding: 9px 12px 10px;
  color: #e6e6e6;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-preview.no-image strong { padding: 8px 12px; }

.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #ffffff14;
  border-radius: 999px;
  background: #ffffff08;
  font-size: 12px;
}
.chat-reaction span { font-size: 10px; color: #aaa; }
.chat-reaction.mine { border-color: #ffffff4a; background: #ffffff16; }
.chat-reaction.mine span { color: #eee; }
.chat-reaction:hover { border-color: #ffffff38; }

.chat-tools {
  position: absolute;
  top: -12px;
  right: 14px;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background: var(--sidebar, #2c2c2c);
  border: 1px solid #ffffff1c;
  border-radius: 7px;
  box-shadow: 0 6px 18px #0006;
}
.chat-msg:hover .chat-tools,
.chat-msg:focus-within .chat-tools { display: flex; }
.chat-tools > button,
.chat-picker button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 24px;
  border-radius: 5px;
  font-size: 13px;
  color: #a8a8a8;
}
.chat-tools svg { width: 15px; height: 15px; }
.chat-tools > button:hover,
.chat-tools > button:focus-visible,
.chat-picker button:hover,
.chat-picker button:focus-visible { background: #ffffff12; color: #eee; outline: none; }
.chat-tools > button.confirm { background: var(--call-red, #a44248); color: #fff; }
.chat-picker {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 26px);
  gap: 2px;
  padding: 4px;
  background: var(--sidebar, #2c2c2c);
  border: 1px solid #ffffff1c;
  border-radius: 8px;
  box-shadow: 0 8px 22px #0007;
}
.chat-picker[hidden] { display: none; }

.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: #d6d6d6;
  color: #171717;
  font-size: 10.5px;
  font-weight: 600;
  box-shadow: 0 6px 16px #0006;
}
.chat-jump svg { width: 13px; height: 13px; }
.chat-jump[hidden] { display: none; }

/* Typing: who is typing (avatars) + the microphone's pixel grid as a wave. */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 18px;
  color: #8e8e8e;
  font-size: 10.5px;
}
.chat-typing-avatars { display: flex; }
.chat-typing-avatars .chat-avatar {
  width: 18px;
  height: 18px;
  font-size: 7.5px;
  box-shadow: 0 0 0 2px var(--bg, #303030);
}
.chat-typing-avatars .chat-avatar + .chat-avatar { margin-left: -5px; }
.chat-typing-text { text-transform: none; }
.chat-typing-meter {
  display: block;
  width: 19px;
  height: 11px;
  flex: none;
  fill: currentColor;
  color: #d6d6d6;
  shape-rendering: crispEdges;
}
.chat-typing-meter rect { opacity: 0; }
.chat-typing-meter rect[data-d="0"] { opacity: 0.3; animation: chat-pixel-0 1.1s steps(1, end) infinite; animation-delay: calc(var(--c) * 110ms); }
.chat-typing-meter rect[data-d="1"] { animation: chat-pixel-1 1.1s steps(1, end) infinite; animation-delay: calc(var(--c) * 110ms); }
.chat-typing-meter rect[data-d="2"] { animation: chat-pixel-2 1.1s steps(1, end) infinite; animation-delay: calc(var(--c) * 110ms); }
@keyframes chat-pixel-0 { 0% { opacity: 0.3; } 20% { opacity: 0.75; } 60% { opacity: 0.3; } }
@keyframes chat-pixel-1 { 0% { opacity: 0; } 20% { opacity: 0.75; } 45% { opacity: 0; } }
@keyframes chat-pixel-2 { 0% { opacity: 0; } 27% { opacity: 0.6; } 38% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chat-typing-meter rect { animation: none !important; }
  .chat-typing-meter rect[data-d="0"], .chat-typing-meter rect[data-d="1"] { opacity: 0.5; }
}

.chat-composer {
  padding: 0 14px 12px;
}
.chat-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: -1px;
  border: 1px solid #ffffff16;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #ffffff06;
  color: #9a9a9a;
  font-size: 10.5px;
}
.chat-context strong { color: #ddd; text-transform: none; }
.chat-context[hidden] { display: none; }
.chat-context button { display: grid; width: 18px; height: 18px; color: #888; padding: 0; }
.chat-context button svg { width: 14px; height: 14px; }
.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border: 1px solid #ffffff1c;
  border-radius: 9px;
  background: #262626;
}
.chat-context:not([hidden]) + .chat-input { border-top-left-radius: 0; border-top-right-radius: 0; }
.chat-input:focus-within { border-color: #ffffff40; }
.chat-input textarea {
  flex: 1;
  min-height: 22px;
  max-height: 160px;
  padding: 3px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  text-transform: none;
}
.chat-input textarea::placeholder { color: #707070; text-transform: lowercase; }
.chat-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #d6d6d6;
  color: #171717;
}
.chat-send svg { width: 15px; height: 15px; }
.chat-send:disabled { background: #ffffff10; color: #6d6d6d; }
.chat-hint { display: block; margin-top: 5px; color: #666; font-size: 9.5px; }
.chat-hint kbd { font: inherit; color: #888; }
.chat-compact .chat-hint { display: none; }
.chat-compact .chat-msg { padding-left: 14px; padding-right: 14px; }
.chat-compact .chat-typing { padding: 0 14px; }

/* Room page: chat fills the main column. */
.main:has(.room-chat) { overflow: hidden; }
.main:has(.room-chat) .meeting-layout { min-height: 0; grid-template-rows: minmax(0, 1fr); }
.main:has(.room-chat) .detail-pane { min-height: 0; overflow-y: auto; }
.list-pane.room-pane { display: flex; flex-direction: column; min-height: 0; }
.room-chat { flex: 1; min-height: 0; }
.detail-pane .room-meetings { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 4px; }
.room-meeting { display: flex; align-items: center; gap: 8px; padding: 7px 25px; }
.room-meeting > button:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 0; text-align: left; }
.room-meeting strong { font-size: 11.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meeting small { font-size: 10px; color: var(--muted); }
.room-meetings-empty { margin: 6px 25px 2px; font-size: 10.5px; color: var(--muted); }

/* In-call chat panel. */
.meeting-page { position: relative; }
.call-chat {
  position: absolute;
  top: 25px;
  right: 25px;
  bottom: 25px;
  z-index: 15;
  width: 330px;
  display: flex;
  flex-direction: column;
  background: #2a2a2a;
  border: 1px solid #ffffff14;
  border-radius: 10px;
  box-shadow: 0 12px 40px #0006;
  overflow: hidden;
}
.call-chat[hidden] { display: none; }
.call-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 550;
}
.call-chat-head button { display: grid; width: 22px; height: 22px; place-items: center; color: #999; padding: 0; }
.call-chat-head svg { width: 15px; height: 15px; }
.call-chat .chat { flex: 1; }
.meeting-page.chat-open > :not(.call-chat) { margin-right: 345px; }
.meeting-page.is-sharing .call-chat,
.meeting-page.call-maximized .call-chat { top: 12px; right: 12px; bottom: 12px; }
#toggle-chat { position: relative; }
#toggle-chat svg { width: 15px; height: 15px; }
#toggle-chat[aria-pressed="true"] { background: #ffffff16; color: #eee; }
.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d6d6d6;
  color: #171717;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.chat-badge[hidden] { display: none; }
@media (max-width: 760px) {
  .call-chat { inset: 0; width: auto; border-radius: 0; }
  .meeting-page.chat-open > :not(.call-chat) { margin-right: 0; }
}

/* Ghost notifications: translucent cards, bottom right, above the call controls. */
.chat-toasts {
  position: absolute;
  right: 25px;
  bottom: 84px;
  z-index: 16;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: min(320px, calc(100% - 50px));
  pointer-events: none;
}
.meeting-page.chat-open .chat-toasts { display: none; }
.meeting-page.is-sharing .chat-toasts,
.meeting-page.call-maximized .chat-toasts { right: 16px; bottom: 76px; }
.chat-toast {
  position: relative;
  pointer-events: auto;
  border: 1px solid #ffffff1f;
  border-radius: 12px;
  background: #2626268a;
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 14px 40px #0007, inset 0 1px 0 #ffffff12;
  color: var(--text, #d4d4d4);
  animation: chat-toast-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 200ms ease, transform 200ms ease;
}
.chat-toast.bump { animation: chat-toast-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.chat-toast.leaving { opacity: 0; transform: translateY(6px) scale(0.98); }
@keyframes chat-toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.chat-toast-open {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 11px 34px 11px 12px;
  text-align: left;
  color: inherit;
}
.chat-toast-open .chat-avatar { flex: none; }
.chat-toast-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chat-toast-head { display: flex; align-items: baseline; gap: 7px; }
.chat-toast-head strong { font-size: 12px; font-weight: 600; color: #eee; text-transform: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-toast-head small { flex: none; font-size: 9.5px; color: #9a9a9a; }
.chat-toast-body {
  font-size: 11.5px;
  line-height: 1.4;
  color: #c9c9c9;
  text-transform: none;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-toast-close {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  color: #9a9a9a;
  opacity: 0;
}
.chat-toast-close svg { width: 13px; height: 13px; }
.chat-toast:hover .chat-toast-close,
.chat-toast:focus-within .chat-toast-close { opacity: 1; }
.chat-toast-close:hover { background: #ffffff14; color: #eee; }
@media (prefers-reduced-motion: reduce) {
  .chat-toast, .chat-toast.bump { animation: none; transition: none; }
}
@media (max-width: 760px) {
  .chat-toasts { right: 12px; left: 12px; width: auto; }
}

/* Collapsed run of deleted messages. */
.chat-deleted-run {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 18px 4px 56px;
  color: #6f6f6f;
  font-size: 10.5px;
  font-style: italic;
}
.chat-deleted-run svg { width: 12px; height: 12px; flex: none; }
.chat-deleted-run.flash { animation: chat-flash 1.2s ease-out; border-radius: 6px; }
.chat-compact .chat-deleted-run { margin-left: 52px; margin-right: 14px; }
