/* Messages — pixel-close mockup */
#messages-main:not(.hidden),
#messages-page-root {
  background: #e8eef6 !important;
}
body.gce-viewport-shell #messages-main:not(.hidden) {
  padding: 10px 12px 12px !important;
}

.msg-page {
  --msg-blue: #1e3a8a;
  --msg-blue-deep: #1e40af;
  --msg-blue-soft: #dbeafe;
  --msg-blue-mid: #93c5fd;
  --msg-ink: #0f172a;
  --msg-muted: #64748b;
  --msg-line: #e2e8f0;
  --msg-bg: #e8eef6;
  --msg-panel: #ffffff;
  --msg-theirs: #eef2f7;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  font-family: Inter, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.msg-page-head { display: none !important; }

.msg-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 280px;
  gap: 12px;
  min-height: 0;
  flex: 1;
  height: calc(100dvh - 72px);
}
.msg-layout.is-rail-collapsed {
  grid-template-columns: 300px minmax(0, 1fr);
}
.msg-layout.is-rail-collapsed .msg-rail {
  display: none;
}

.msg-aside,
.msg-main,
.msg-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: var(--msg-panel);
  border: 1px solid #dfe7f1;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.msg-aside-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 10px;
  flex-shrink: 0;
}
.msg-aside-head h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--msg-ink);
  letter-spacing: -0.03em;
}
.msg-compose-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.msg-compose-btn:hover { background: #f3f6fb; color: var(--msg-blue); }
.msg-compose-btn svg { width: 20px; height: 20px; }

.msg-search-wrap {
  position: relative;
  padding: 0 16px 10px;
  flex-shrink: 0;
}
.msg-search-wrap > svg {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #9aa6b8;
  pointer-events: none;
}
.msg-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  background: #f4f7fb;
  border-radius: 999px;
  padding: 11px 14px 11px 42px;
  font: inherit;
  font-size: 13.5px;
  color: var(--msg-ink);
}
.msg-search::placeholder { color: #9aa6b8; }
.msg-search:focus {
  outline: none;
  border-color: var(--msg-blue-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
}

.msg-create-group-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 16px 12px;
  width: calc(100% - 32px);
  box-sizing: border-box;
  border: none;
  background: #dbebff;
  color: #1d4ed8;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.msg-create-group-btn:hover { background: #cfe3ff; }
.msg-create-group-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

.msg-thread-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 10px 14px;
}

.msg-thread-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 14px;
  padding: 11px 12px 11px 14px;
  cursor: pointer;
  font: inherit;
  margin-bottom: 3px;
  position: relative;
  box-sizing: border-box;
}
.msg-thread-item:hover { background: #f5f8fc; }
.msg-thread-item.is-active {
  background: var(--msg-blue-soft);
}
.msg-thread-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--msg-blue);
}

.msg-thread-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}
.msg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dde7ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
}
.msg-avatar.is-group { background: #e0e7ff; color: #3730a3; font-size: 18px; }
.msg-avatar.c0 { background: #e0e7ff; color: #4338ca; }
.msg-avatar.c1 { background: #dcfce7; color: #166534; }
.msg-avatar.c2 { background: #fce7f3; color: #9d174d; }
.msg-avatar.c3 { background: #fef3c7; color: #92400e; }
.msg-avatar.c4 { background: #dbeafe; color: #1e40af; }
.msg-avatar.c5 { background: #ffedd5; color: #9a3412; }
.msg-status-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-sizing: border-box;
}
.msg-status-dot.is-online { background: #22c55e; }
.msg-status-dot.is-offline { background: #c0c7d4; }

.msg-thread-copy { min-width: 0; }
.msg-thread-copy .msg-thread-name {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: var(--msg-ink);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.25;
  word-break: break-word;
}
.msg-thread-copy .msg-thread-role-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  min-width: 0;
}
.msg-thread-preview {
  display: block;
  margin-top: 3px;
  color: #7b8798;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-thread-preview.is-online { color: #16a34a; font-weight: 650; }
.msg-thread-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex: 0 0 auto;
  align-self: flex-start;
  padding-top: 1px;
}
.msg-thread-time {
  font-size: 11px;
  font-weight: 600;
  color: #9aa6b8;
  white-space: nowrap;
}
.msg-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10px;
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 999px;
  background: #2563eb;
  color: transparent;
  font-size: 0;
  box-shadow: 0 0 0 2px #fff;
}
.msg-unread-badge.is-count {
  min-width: 20px;
  width: auto;
  height: 20px;
  padding: 0 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.msg-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #eef2f7;
  flex-shrink: 0;
}
.msg-main-head-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.msg-main-head-user .msg-avatar { width: 42px; height: 42px; font-size: 13px; }
.msg-main-head-text { min-width: 0; }
.msg-main-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.msg-main-title-row h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-thread-name-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.msg-thread-name-row .msg-thread-name {
  width: 100%;
}
.msg-role-pill {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.3;
  background: #eef2f7;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.msg-role-pill .msg-role-ico {
  display: inline-flex;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  opacity: 0.92;
}
.msg-role-pill .msg-role-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}
.msg-role-pill .msg-role-txt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-role-pill.is-lg {
  max-width: none;
  padding: 4px 10px 4px 8px;
  font-size: 11.5px;
  gap: 5px;
}
.msg-role-pill.is-lg .msg-role-ico {
  width: 14px;
  height: 14px;
}
.msg-role-pill.hidden { display: none !important; }
.msg-role-pill.role-admin { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.msg-role-pill.role-pm { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.msg-role-pill.role-cm { background: #ffedd5; color: #c2410c; border-color: #fdba74; }
.msg-role-pill.role-accountant { background: #dcfce7; color: #166534; border-color: #86efac; }
.msg-role-pill.role-safety { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.msg-role-pill.role-field { background: #dcfce7; color: #166534; border-color: #86efac; }
.msg-role-pill.role-group { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.msg-role-pill.role-office { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.msg-main-head-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--msg-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-main-head-text p {
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--msg-muted);
}
.msg-main-head-text p.is-online { color: #16a34a; }
.msg-main-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.msg-main-head-actions.hidden { display: none !important; }
.msg-icon-btn {
  width: 38px;
  height: 38px;
  border: 1.5px solid #d7dee8;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.msg-icon-btn:hover { border-color: var(--msg-blue-mid); color: var(--msg-blue); background: #f8fbff; }
.msg-icon-btn svg { width: 17px; height: 17px; }
.msg-icon-btn:disabled {
  opacity: 1;
  color: #94a3b8;
  cursor: default;
}

.msg-message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f3f6fb;
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
  align-self: stretch;
}

.msg-profile-card {
  align-self: center;
  width: min(100%, 340px);
  margin: 8px auto 18px;
  padding: 18px 18px 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  text-align: center;
}
.msg-profile-card-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.msg-profile-avatar {
  width: 64px !important;
  height: 64px !important;
  font-size: 18px !important;
}
.msg-profile-copy { min-width: 0; width: 100%; }
.msg-profile-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.msg-profile-name-row b {
  font-size: 16px;
  font-weight: 800;
  color: var(--msg-ink);
}
.msg-profile-meta {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--msg-ink);
}
.msg-profile-meta span {
  color: var(--msg-muted);
  font-weight: 650;
}
.msg-profile-meta em {
  font-style: normal;
  font-weight: 750;
  color: #64748b;
}
.msg-profile-meta em.is-online { color: #16a34a; }
.msg-profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.msg-profile-btn {
  flex: 1;
  min-height: 38px;
  border-radius: 12px;
  border: 1.5px solid #d7dee8;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  padding: 8px 10px;
}
.msg-profile-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.msg-profile-btn.is-primary {
  background: var(--msg-blue);
  border-color: var(--msg-blue);
  color: #fff;
}
.msg-profile-btn.is-primary:hover { filter: brightness(0.96); }

.msg-day-sep {
  align-self: center;
  margin: 4px 0 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e4ebf5;
  color: #6b778a;
  font-size: 11.5px;
  font-weight: 700;
}

.msg-bubble-row {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: min(62%, 520px);
  gap: 6px;
  box-sizing: border-box;
}
.msg-bubble-row.is-mine {
  align-self: flex-end;
  align-items: flex-end;
  margin-left: auto;
  margin-right: 0;
}
.msg-bubble-row.is-theirs {
  align-self: flex-start;
  align-items: flex-start;
  margin-left: 0;
  margin-right: auto;
}

.msg-bubble {
  padding: 12px 14px 10px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  position: relative;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.msg-bubble-row.is-theirs .msg-bubble {
  background: var(--msg-theirs);
  border-bottom-left-radius: 5px;
  border-color: transparent;
}
.msg-bubble-row.is-mine .msg-bubble {
  background: var(--msg-blue);
  border-bottom-right-radius: 5px;
  box-shadow: 0 6px 16px rgba(30, 58, 138, 0.28);
}

.msg-reply-quote {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border-left: 3px solid rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.18);
}
.msg-bubble-row.is-theirs .msg-reply-quote {
  border-left-color: var(--msg-blue);
  background: #edf3ff;
}
.msg-reply-quote b {
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 2px;
  opacity: 0.95;
}
.msg-reply-quote span {
  display: block;
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-bubble-row.is-mine .msg-reply-quote b,
.msg-bubble-row.is-mine .msg-reply-quote span { color: #fff; }
.msg-bubble-row.is-theirs .msg-reply-quote b { color: #1e40af; }
.msg-bubble-row.is-theirs .msg-reply-quote span { color: #475569; }

.msg-bubble-body {
  font-size: 14px;
  color: var(--msg-ink);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.msg-bubble-row.is-mine .msg-bubble-body { color: #fff; }

.msg-bubble-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}
.msg-bubble-row.is-mine .msg-bubble-foot {
  color: rgba(255, 255, 255, 0.8);
  justify-content: flex-end;
}
.msg-bubble-checks {
  display: inline-flex;
  color: #93c5fd;
}
.msg-bubble-checks svg { width: 15px; height: 15px; }

.msg-reacts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5eaf2;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  margin-top: -2px;
}
.msg-react {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  padding: 1px 3px;
  border-radius: 6px;
  color: #334155;
  font-weight: 700;
}
.msg-react:hover { background: #f1f5f9; }
.msg-react-add {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}
.msg-react-add:hover { background: #f1f5f9; color: var(--msg-blue); }

.msg-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  border-bottom-left-radius: 5px;
  background: #fff;
  border: 1px solid #eef2f7;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.msg-typing-dots { display: inline-flex; gap: 3px; }
.msg-typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #60a5fa;
  display: block;
  animation: msgTyping 1.1s infinite ease-in-out;
}
.msg-typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.msg-typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes msgTyping {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.msg-attach {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  text-decoration: none;
  max-width: 100%;
}
.msg-bubble-row.is-theirs .msg-attach {
  border-color: var(--msg-blue-mid);
  background: var(--msg-blue-soft);
  color: #1e3a8a;
}
.msg-attach-icon { font-size: 16px; }
.msg-attach-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.msg-attach-copy b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-attach-copy small { font-size: 11px; opacity: 0.85; }

.msg-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid #eef2f7;
  flex-shrink: 0;
  background: #fff;
}
.msg-composer.hidden { display: none !important; }

.msg-reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f3f7fd;
  border: 1px solid #e2eaf5;
}
.msg-reply-bar.hidden { display: none !important; }
.msg-reply-bar-copy { min-width: 0; flex: 1; }
.msg-reply-bar-copy b { display: block; font-size: 12px; color: #1d4ed8; }
.msg-reply-bar-copy span {
  display: block;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-reply-bar-x {
  border: none;
  background: transparent;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
}

.msg-attach-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #e5eaf2;
  background: #f7f9fc;
}
.msg-attach-preview.hidden { display: none !important; }
.msg-attach-preview-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fee2e2;
  color: #991b1b;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}
.msg-attach-preview-copy { min-width: 0; flex: 1 1 auto; }
.msg-attach-preview-copy b {
  display: block;
  font-size: 13px;
  color: var(--msg-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-attach-preview-copy small { font-size: 11px; color: var(--msg-muted); }
.msg-attach-preview-x {
  border: none;
  background: transparent;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.msg-attach-preview-x:hover { background: #eef2f7; color: #475569; }

.msg-composer-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.msg-composer-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 6px 8px;
  border: 1px solid #e5eaf2;
  border-radius: 999px;
  background: #f7f9fc;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.msg-composer-bar:focus-within {
  border-color: var(--msg-blue-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
}
.msg-attach-btn,
.msg-emoji-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #7b8798;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.msg-mic-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #eef2f7;
  color: #64748b;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  margin-right: 2px;
}
.msg-attach-btn:hover,
.msg-emoji-btn:hover { background: #eef2f7; color: var(--msg-blue); }
.msg-mic-btn:hover { background: #e2e8f0; color: var(--msg-blue); }
.msg-attach-btn svg,
.msg-emoji-btn svg,
.msg-mic-btn svg { width: 18px; height: 18px; }
.msg-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.msg-input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: none;
  background: transparent;
  padding: 8px 6px;
  font: inherit;
  font-size: 14px;
  color: var(--msg-ink);
  min-height: 24px;
  max-height: 96px;
  line-height: 1.4;
}
.msg-input:focus { outline: none; }
.msg-input::placeholder { color: #9aa6b8; }

.msg-send-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--msg-blue);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 128, 237, 0.38);
  padding: 0;
}
.msg-send-btn:hover { background: var(--msg-blue-deep); }
.msg-send-btn:active { transform: scale(0.97); }
.msg-send-btn svg { width: 18px; height: 18px; margin-left: 1px; }

.msg-empty {
  margin: 40px 16px;
  text-align: center;
  color: var(--msg-muted);
  font-size: 14px;
}

/* Count pill styles live in main.css (#nav-messages-badge / --count). */

@media (max-width: 980px) {
  .msg-layout,
  .msg-layout.is-rail-collapsed { grid-template-columns: 280px minmax(0, 1fr); }
  .msg-rail { display: none !important; }
}
@media (max-width: 860px) {
  .msg-layout,
  .msg-layout.is-rail-collapsed {
    grid-template-columns: 1fr;
    height: auto;
  }
  .msg-aside { max-height: 300px; }
  .msg-main { min-height: 440px; }
  .msg-rail { display: none !important; }
}

body:not([data-gce-mode="light"]) #messages-main:not(.hidden),
body:not([data-gce-mode="light"]) #messages-page-root { background: #0b1220 !important; }
body:not([data-gce-mode="light"]) .msg-aside,
body:not([data-gce-mode="light"]) .msg-main,
body:not([data-gce-mode="light"]) .msg-composer {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
}
body:not([data-gce-mode="light"]) .msg-message-list { background: #0b1220; }
body:not([data-gce-mode="light"]) .msg-profile-card {
  background: #111827;
  border-color: #334155;
  box-shadow: none;
}
body:not([data-gce-mode="light"]) .msg-profile-name-row b,
body:not([data-gce-mode="light"]) .msg-profile-meta { color: #e2e8f0; }
body:not([data-gce-mode="light"]) .msg-profile-btn {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
body:not([data-gce-mode="light"]) .msg-bubble-row.is-theirs .msg-bubble {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.2);
}
body:not([data-gce-mode="light"]) .msg-aside-head h3,
body:not([data-gce-mode="light"]) .msg-main-head-text h3,
body:not([data-gce-mode="light"]) .msg-thread-copy b,
body:not([data-gce-mode="light"]) .msg-bubble-body { color: #e2e8f0; }


.msg-group-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
}
.msg-group-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.msg-group-dialog {
  position: relative;
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  padding: 14px;
  gap: 10px;
}
.msg-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.msg-group-head h3 {
  margin: 0;
  font-size: 17px;
  color: #0f172a;
}
.msg-group-x {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #475569;
}
.msg-group-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.msg-group-name {
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: #0f172a;
}
.msg-group-hint {
  margin: 0;
  font-size: 12px;
  color: #475569;
}
.msg-group-members {
  flex: 1;
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msg-group-member {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.msg-group-member:hover { background: #f8fafc; }
.msg-group-member input { margin-top: 3px; }
.msg-group-member span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.msg-group-member b { font-size: 13px; color: #0f172a; }
.msg-group-member small { font-size: 11px; color: #475569; }
.msg-group-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.msg-group-cancel,
.msg-group-create {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.msg-group-cancel {
  border: 1px solid #d8e0ea;
  background: #fff;
  color: #475569;
}
.msg-group-create {
  border: 1px solid #1e3a8a;
  background: #1e3a8a;
  color: #fff;
}
.msg-group-create:disabled { opacity: 0.6; cursor: not-allowed; }

body:not([data-gce-mode="light"]) .msg-group-dialog {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.28);
}
body:not([data-gce-mode="light"]) .msg-group-head h3,
body:not([data-gce-mode="light"]) .msg-group-member b { color: #e2e8f0; }
body:not([data-gce-mode="light"]) .msg-group-name,
body:not([data-gce-mode="light"]) .msg-group-members {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}
body:not([data-gce-mode="light"]) .msg-create-group-btn {
  background: rgba(30, 58, 138, 0.45);
  border-color: #93c5fd;
  color: #dbeafe;
}

/* —— New message toast (top-right card) —— */
.gce-msg-toast {
  position: fixed;
  top: 72px;
  right: 22px;
  z-index: 980;
  width: min(380px, calc(100vw - 32px));
  padding: 14px 16px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-family: inherit;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.gce-msg-toast.is-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.gce-msg-toast.hidden { display: none !important; }

.gce-msg-toast-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.gce-msg-toast-ico {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.gce-msg-toast-ico svg { width: 12px; height: 12px; display: block; }
.gce-msg-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  flex: 1 1 auto;
  min-width: 0;
}
.gce-msg-toast-when {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  flex: 0 0 auto;
}
.gce-msg-toast-x {
  border: none;
  background: transparent;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
}
.gce-msg-toast-x:hover { background: #f1f5f9; color: #475569; }

.gce-msg-toast-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.gce-msg-toast-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
}
.gce-msg-toast-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
}
.gce-msg-toast-online {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-sizing: border-box;
}
.gce-msg-toast-online.is-off { background: #94a3b8; }
.gce-msg-toast-copy {
  min-width: 0;
  flex: 1 1 auto;
  padding-top: 2px;
}
.gce-msg-toast-name {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 3px;
}
.gce-msg-toast-preview {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.35;
}
.gce-msg-toast-preview span {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gce-msg-toast-clip {
  flex: 0 0 auto;
  color: #94a3b8;
  margin-top: 1px;
}
.gce-msg-toast-clip svg { width: 14px; height: 14px; display: block; }

.gce-msg-toast-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.gce-msg-toast-dismiss {
  border: none;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
}
.gce-msg-toast-dismiss:hover { background: #f1f5f9; }
.gce-msg-toast-reply {
  border: none;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
.gce-msg-toast-reply:hover { background: #1d4ed8; }

body:not([data-gce-mode="light"]) .gce-msg-toast {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
}
body:not([data-gce-mode="light"]) .gce-msg-toast-title { color: #cbd5e1; }
body:not([data-gce-mode="light"]) .gce-msg-toast-name { color: #f8fafc; }
body:not([data-gce-mode="light"]) .gce-msg-toast-preview { color: #94a3b8; }
body:not([data-gce-mode="light"]) .gce-msg-toast-dismiss { color: #e2e8f0; }
body:not([data-gce-mode="light"]) .gce-msg-toast-dismiss:hover { background: rgba(148, 163, 184, 0.12); }
body:not([data-gce-mode="light"]) .gce-msg-toast-x:hover { background: rgba(148, 163, 184, 0.12); }
body:not([data-gce-mode="light"]) .gce-msg-toast-avatar { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
body:not([data-gce-mode="light"]) .gce-msg-toast-online { border-color: #0f172a; }

html.gce-lights-off .gce-msg-toast {
  position: fixed !important;
  z-index: 10050;
}

/* ── Hover toolbar / poll / emoji / DnD / sent toast ── */
.msg-bubble-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 100%;
  align-items: stretch;
}
.msg-bubble-row.is-mine .msg-bubble-wrap { align-items: flex-end; }
.msg-bubble-row.is-theirs .msg-bubble-wrap { align-items: flex-start; }
.msg-bubble-wrap .msg-bubble { max-width: 100%; }

.msg-hover-tools {
  position: absolute;
  top: -14px;
  right: 8px;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px 4px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5eaf2;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  z-index: 5;
}
.msg-bubble-row.is-mine .msg-hover-tools { right: auto; left: 8px; }
.msg-bubble-row:hover .msg-hover-tools,
.msg-bubble-wrap:focus-within .msg-hover-tools { display: inline-flex; }
.msg-tool-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
}
.msg-tool-btn:hover { background: #f1f5f9; color: var(--msg-blue); }
.msg-tool-btn svg { width: 15px; height: 15px; }
.msg-tool-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 6;
}
.msg-tool-btn[data-tip]:hover::after { opacity: 1; }

.msg-react.is-me {
  background: #dbeafe;
  color: #1e3a8a;
}

.msg-poll {
  margin-top: 4px;
  padding: 12px 12px 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e5eaf2;
  color: #0f172a;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.msg-bubble-row.is-mine .msg-poll {
  background: rgba(255, 255, 255, 0.96);
}
.msg-poll-q {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}
.msg-poll-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e5eaf2;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 0 6px;
  cursor: pointer;
  font: inherit;
  color: #0f172a;
}
.msg-poll-opt:hover { border-color: #93c5fd; background: #eff6ff; }
.msg-poll-opt.is-selected {
  border-color: #2f80ed;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(47, 128, 237, 0.25);
}
.msg-poll-opt-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 5px;
}
.msg-poll-bar {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.msg-poll-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f80ed, #60a5fa);
  width: 0;
  transition: width 0.35s ease;
}
.msg-poll-total {
  margin: 6px 0 0;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
}

.msg-attach-pdf .msg-attach-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fee2e2;
  color: #991b1b;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  flex: 0 0 auto;
}

.msg-message-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f3f6fb;
}
.msg-message-list-wrap .msg-message-list { flex: 1; width: 100%; }

.msg-sent-toast {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5eaf2;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}
.msg-sent-toast.hidden { display: none !important; }
.msg-sent-toast .ok { color: #166534; font-weight: 900; }
.msg-sent-toast button {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.msg-typing-row {
  padding: 0 18px 8px;
  flex-shrink: 0;
}
.msg-typing-row.hidden { display: none !important; }

.msg-dropzone {
  margin: 0 0 2px;
  padding: 14px 12px;
  border: 1.5px dashed #93c5fd;
  border-radius: 14px;
  background: #f0f7ff;
  color: #1e3a8a;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  display: none;
}
.msg-composer.is-drag .msg-dropzone { display: block; }
.msg-dropzone span { display: block; margin-top: 4px; color: #475569; font-weight: 600; }

.msg-emoji-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 8px;
  width: min(380px, calc(100vw - 40px));
  max-height: min(420px, 55vh);
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  z-index: 30;
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.msg-emoji-pop.is-open { display: flex; }
.msg-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px 10px 10px;
  max-height: 220px;
  overflow: auto;
  flex: 1;
}
.msg-emoji-grid button {
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1.4;
  cursor: pointer;
  padding: 4px;
}
.msg-emoji-grid button:hover { background: #f1f5f9; }
.msg-emoji-section-label {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  padding: 4px 2px;
  text-transform: none;
}
.msg-emoji-tabs {
  display: flex;
  border-top: 1px solid #eef2f7;
  background: #f8fafc;
}
.msg-emoji-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
}
.msg-emoji-tabs button.is-active {
  color: #1e3a8a;
  box-shadow: inset 0 -2px 0 #2f80ed;
  background: #fff;
}

.msg-composer-bar-wrap { position: relative; flex: 1; min-width: 0; }
.msg-composer-row .msg-composer-bar { width: 100%; }

.msg-thread-search {
  display: none;
  padding: 8px 14px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
}
.msg-thread-search.is-open { display: block; }
.msg-thread-search input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5eaf2;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  background: #fff;
}

.msg-react-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  display: none;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5eaf2;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  z-index: 8;
}
.msg-react-picker.is-open { display: inline-flex; }
.msg-react-picker button {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.msg-react-picker button:hover { background: #f1f5f9; }

.msg-edited-tag {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.75;
  margin-left: 4px;
}

.msg-emoji-pop-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 6px;
  border-bottom: 1px solid #eef2f7;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.msg-emoji-cat {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}
.msg-emoji-cat.is-active,
.msg-emoji-cat:hover { background: #eff6ff; }
.msg-emoji-search {
  flex: 1;
  min-width: 120px;
  border: 1px solid #e5eaf2;
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  background: #f8fafc;
}
.msg-emoji-hint {
  margin: 0;
  padding: 6px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.msg-list-filters {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  flex-shrink: 0;
}
.msg-list-filter {
  border: 1px solid #e5eaf2;
  background: #f8fafc;
  color: #64748b;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.msg-list-filter:hover { background: #eff6ff; color: #1e3a8a; }
.msg-list-filter.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.msg-sticker-packs {
  display: flex;
  gap: 4px;
  padding: 10px 10px 6px;
  border-bottom: 1px solid #eef2f7;
  overflow-x: auto;
  flex-shrink: 0;
}
.msg-sticker-pack {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  flex: 0 0 auto;
}
.msg-sticker-pack:hover { background: #f1f5f9; }
.msg-sticker-pack.is-active {
  background: #eff6ff;
  border-color: #93c5fd;
}
.msg-sticker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 12px 0;
  flex-shrink: 0;
}
.msg-sticker-head b {
  font-size: 13px;
  color: #0f172a;
}
.msg-sticker-head span {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}
.msg-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px 12px;
  max-height: 240px;
  overflow: auto;
  flex: 1;
}
.msg-sticker-grid .msg-emoji-section-label {
  grid-column: 1 / -1;
}
.msg-sticker-pick {
  border: 1px solid #eef2f7;
  background: #f8fafc;
  border-radius: 14px;
  aspect-ratio: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 6px;
  transition: transform 0.12s ease, background 0.12s ease;
}
.msg-sticker-pick span {
  font-size: 36px;
  line-height: 1;
}
.msg-sticker-pick:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: scale(1.04);
}
.msg-sticker-pick.is-gif {
  background: linear-gradient(145deg, #eff6ff, #fdf2f8);
}

.msg-bubble.is-sticker {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px 4px;
}
.msg-bubble-row.is-mine .msg-bubble.is-sticker .msg-bubble-foot {
  color: #94a3b8;
  justify-content: flex-end;
}
.msg-sticker {
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.12));
  user-select: none;
}
.msg-bubble-body.is-solo-emoji {
  font-size: 42px;
  line-height: 1.15;
  padding: 2px 0;
}

.msg-message-list {
  gap: 10px;
  padding: 16px 18px 12px;
}
.msg-bubble-row {
  max-width: min(65%, 560px);
}
.msg-bubble {
  min-width: 64px;
}

.msg-layout {
  grid-template-columns: 300px minmax(0, 1fr) 280px;
  gap: 14px;
}
.msg-layout.is-rail-collapsed {
  grid-template-columns: 300px minmax(0, 1fr);
}
.msg-aside {
  border-radius: 22px;
}
.msg-main,
.msg-rail {
  border-radius: 22px;
}
.msg-main-head {
  padding: 14px 18px;
}
.msg-composer {
  padding: 12px 16px 18px;
}

/* Right conversation rail */
.msg-rail {
  padding: 0;
}
.msg-rail-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 16px 16px 20px;
}
.msg-rail-section {
  padding: 14px 0;
  border-bottom: 1px solid #eef2f7;
}
.msg-rail-section:last-child { border-bottom: none; }
.msg-rail-section h4 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.msg-rail-about {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-rail-about-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--msg-ink);
  letter-spacing: -0.02em;
}
.msg-rail-about-sub {
  margin: 0;
  font-size: 12px;
  color: var(--msg-muted);
}
.msg-rail-about-sub.is-online { color: #16a34a; font-weight: 650; }
.msg-rail-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-rail-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e8eef6;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
}
.msg-rail-file:hover { border-color: #93c5fd; background: #eff6ff; }
.msg-rail-file-ico {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  font-weight: 800;
}
.msg-rail-file-ico.is-img { background: #dbeafe; color: #1e3a8a; }
.msg-rail-file-copy { min-width: 0; flex: 1; }
.msg-rail-file-copy b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--msg-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-rail-file-copy small {
  display: block;
  font-size: 11px;
  color: var(--msg-muted);
  margin-top: 2px;
}
.msg-rail-people {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-rail-person {
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-rail-person .msg-avatar {
  width: 34px;
  height: 34px;
  font-size: 11px;
}
.msg-rail-person-copy { min-width: 0; flex: 1; }
.msg-rail-person-copy b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--msg-ink);
}
.msg-rail-mute {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.msg-rail-mute span {
  font-size: 13px;
  font-weight: 650;
  color: var(--msg-ink);
}
.msg-mute-switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: #cbd5e1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s ease;
}
.msg-mute-switch.is-on { background: #1e3a8a; }
.msg-mute-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.2);
  transition: transform .15s ease;
}
.msg-mute-switch.is-on::after { transform: translateX(18px); }
.msg-rail-empty {
  margin: 0;
  font-size: 12px;
  color: var(--msg-muted);
}
.msg-rail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--msg-muted);
  font-size: 13px;
}

/* Image attachments in chat */
.msg-attach-img {
  display: block;
  max-width: min(280px, 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
  text-decoration: none;
}
.msg-attach-img img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  background: #f1f5f9;
}
.msg-img-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-width: min(320px, 100%);
  border-radius: 14px;
  overflow: hidden;
}
.msg-img-grid .msg-attach-img {
  max-width: none;
  border-radius: 0;
  border: none;
}
.msg-img-grid .msg-attach-img img { max-height: 140px; }
.msg-bubble-row.is-mine .msg-attach-img { border-color: rgba(255,255,255,0.2); }

.msg-profile-card { display: none !important; }

@media (max-width: 1100px) {
  .msg-layout,
  .msg-layout.is-rail-collapsed {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .msg-rail { display: none !important; }
}
@media (max-width: 980px) {
  .msg-layout,
  .msg-layout.is-rail-collapsed {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

body:not([data-gce-mode="light"]) .msg-list-filter {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.22);
  color: #94a3b8;
}
body:not([data-gce-mode="light"]) .msg-list-filter.is-active {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.35);
}
body:not([data-gce-mode="light"]) .msg-emoji-pop,
body:not([data-gce-mode="light"]) .msg-sticker-pick {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}
body:not([data-gce-mode="light"]) .msg-sticker-head b { color: #e2e8f0; }
