/* --- Chat main layout fix: search bar + pinned bar between header and viewport --- */

.mh-chat-main {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.mh-chat-header { grid-row: 1; }
.mh-chat-message-search { grid-row: 2; }
.mh-pinned-bar { grid-row: 3; }
.mh-chat-viewport {
  grid-row: 4;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Floating date pill ────────────────────────────────────────────────────── */

.mh-floating-date {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;

  background: rgba(22, 26, 46, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(232, 234, 246, 0.88);

  opacity: 0;
  transition: opacity 0.18s ease;
}

.mh-floating-date.is-visible {
  opacity: 1;
}

/* ── Scroll-to-bottom button ───────────────────────────────────────────────── */

.mh-scroll-to-bottom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 15;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 34, 54, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--mh-text-primary, #e8eaf6);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.12s ease;
}

.mh-scroll-to-bottom:hover {
  background: rgba(50, 55, 80, 0.95);
}

.mh-scroll-to-bottom.mh-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  display: flex !important;
}

html[data-theme="light"] .mh-scroll-to-bottom {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.10);
  color: #1a1d2e;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .mh-scroll-to-bottom:hover {
  background: rgba(240, 242, 255, 0.98);
}

/* ── Date divider separators ───────────────────────────────────────────────── */

.mh-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0 6px;
  user-select: none;
}

.mh-date-divider span {
  background: rgba(22, 26, 46, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(232, 234, 246, 0.72);
}
.mh-composer { grid-row: 5; }

.mh-mini-text {
  font-size: 13px;
  line-height: 1.45;
}

.mh-auth-shell {
  width: min(420px, calc(100vw - 32px));
  grid-template-columns: 1fr;
  padding: 0;
}

.mh-auth-card {
  position: relative;
  overflow: hidden;
}

.mh-auth-card::after {
  content: "";
  position: absolute;
  inset: auto -15% -35% auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), transparent 68%);
  pointer-events: none;
}

.mh-avatar {
  border: none;
}

.mh-avatar-shell {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.mh-avatar-fallback {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.mh-avatar-fallback.is-icon .hgi-stroke {
  font-size: 0.92em;
  line-height: 1;
}

.mh-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border: 0;
  outline: none;
  box-shadow: none;
  z-index: 2;
}

.mh-chat-item-preview {
  max-width: 100%;
}

.mh-search-section + .mh-search-section {
  margin-top: 0.9rem;
}

.mh-search-section-title {
  margin: 0 0 0.45rem;
  padding: 0 0.15rem;
  color: rgba(233, 239, 255, 0.58);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mh-search-section-meta {
  margin-left: 0.45rem;
  color: rgba(233, 239, 255, 0.42);
  font-size: 11px;
  letter-spacing: normal;
}

.mh-search-result {
  width: 100%;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.85rem;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  transition:
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
  cursor: pointer;
}

.mh-search-result:hover,
.mh-search-result:focus-visible {
  background: rgba(255, 255, 255, 0.085);
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(3, 8, 20, 0.18);
  outline: none;
}

.mh-search-result + .mh-search-result {
  margin-top: 0.45rem;
}

.mh-search-result-avatar {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(123, 182, 255, 0.2), rgba(255, 255, 255, 0.08));
  color: #f5f7ff;
  font-size: 0.84rem;
  font-weight: 800;
}

.mh-search-result-main {
  min-width: 0;
}

.mh-search-result-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.18rem;
}

.mh-search-result-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f5f7ff;
  font-size: 14px;
  font-weight: 700;
}

.mh-search-result-kind {
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: rgba(123, 182, 255, 0.12);
  color: #98c7ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mh-search-result-subtitle,
.mh-search-result-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-search-result-subtitle {
  color: rgba(233, 239, 255, 0.72);
  font-size: 12px;
}

.mh-search-result-preview {
  color: rgba(233, 239, 255, 0.5);
  font-size: 12px;
}

.mh-search-result-action {
  padding: 0.38rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 247, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.mh-search-feedback {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(233, 239, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.mh-search-feedback.is-error {
  background: rgba(255, 140, 140, 0.1);
  color: #ffc1c1;
}

.mh-modal {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.mh-mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.mh-profile-stack {
  display: grid;
  gap: 14px;
}

.mh-profile-section {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.mh-profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mh-profile-badge {
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: rgba(123, 182, 255, 0.12);
  color: #9ccaff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Profile Edit redesign ───────────────────────────────────────────────────── */

.mh-pe-wrap {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Hero */
.mh-pe-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 8px;
  gap: 8px;
}

.mh-pe-avatar-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mh-pe-avatar-label {
  cursor: pointer;
  display: block;
}

.mh-pe-avatar-ring {
  position: relative;
  border-radius: 50%;
}

.mh-pe-avatar {
  width: 88px !important;
  height: 88px !important;
  font-size: 2rem;
  display: block;
}

.mh-pe-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.18s;
  color: #fff;
  font-size: 18px;
}

.mh-pe-avatar-overlay span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mh-pe-avatar-label:hover .mh-pe-avatar-overlay {
  opacity: 1;
}

.mh-pe-hero-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--mh-text-primary, #e8eaf6);
  text-align: center;
}

.mh-pe-hero-meta {
  font-size: 13px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
  text-align: center;
}

.mh-pe-hero-bio {
  font-size: 13px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
  text-align: center;
  max-width: 320px;
  line-height: 1.4;
}

/* Feedback */
.mh-pe-feedback {
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(123, 182, 255, 0.1);
  color: #c8e0ff;
  font-size: 13px;
  line-height: 1.45;
}

.mh-pe-feedback.is-error {
  background: rgba(255, 120, 120, 0.1);
  color: #ffbdbd;
}

/* Section card */
.mh-pe-section {
  background: var(--mh-surface-2, rgba(255,255,255,0.04));
  border-radius: 18px;
  overflow: hidden;
}

.mh-pe-section-head {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mh-text-muted, rgba(232,234,246,0.35));
}

/* Settings row */
.mh-pe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 50px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.mh-pe-row:first-of-type {
  border-top: none;
}

.mh-pe-label {
  font-size: 14px;
  color: var(--mh-text-primary, #e8eaf6);
  min-width: 88px;
  flex-shrink: 0;
}

.mh-pe-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
  text-align: left;
  padding: 14px 0;
  font-family: inherit;
  transition: color 0.15s;
  min-width: 0;
}

.mh-pe-input::placeholder {
  color: var(--mh-text-muted, rgba(232,234,246,0.25));
}

.mh-pe-input:focus {
  color: var(--mh-text-primary, #e8eaf6);
}

.mh-pe-textarea {
  resize: none;
  min-height: 64px;
  line-height: 1.4;
  padding: 14px 0;
}

.mh-pe-row-bio {
  align-items: flex-start;
  padding-top: 4px;
  padding-bottom: 4px;
}

.mh-pe-select {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
  text-align: left;
  padding: 14px 0;
  font-family: inherit;
  cursor: pointer;
  min-width: 0;
}

.mh-pe-select option {
  direction: ltr;
  background: #1a1e28;
  color: #e8eaf6;
}

/* Footer row inside section */
.mh-pe-row-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.mh-pe-hint {
  font-size: 12px;
  color: var(--mh-text-muted, rgba(232,234,246,0.35));
}

/* Devices / Sessions */
.mh-pe-sessions {
  display: flex;
  flex-direction: column;
}

.mh-pe-session {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.mh-pe-session:first-child {
  border-top: none;
}

.mh-pe-session.is-current .mh-pe-session-icon {
  color: var(--mh-accent, #7bb6ff);
}

.mh-pe-session-icon {
  font-size: 20px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.4));
  flex-shrink: 0;
  display: flex;
}

.mh-pe-session-info {
  flex: 1;
  min-width: 0;
}

.mh-pe-session-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--mh-text-primary, #e8eaf6);
}

.mh-pe-session-meta {
  font-size: 12px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.45));
  margin-top: 2px;
}

.mh-pe-session-revoke {
  flex-shrink: 0;
}

.mh-pe-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--mh-text-muted, rgba(232,234,246,0.35));
}

/* Light theme */
html[data-theme="light"] .mh-pe-section {
  background: rgba(0,0,0,0.04);
}

html[data-theme="light"] .mh-pe-input,
html[data-theme="light"] .mh-pe-select {
  color: rgba(26,26,46,0.6);
}

html[data-theme="light"] .mh-pe-input:focus {
  color: rgba(26,26,46,0.9);
}

html[data-theme="light"] .mh-pe-select option {
  background: #f5f7fa;
  color: #1a1a2e;
}

/* ── (legacy profile classes kept for other screens) ─────────── */

.mh-profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.mh-profile-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  box-shadow: none;
}

.mh-profile-avatar-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.mh-profile-avatar-preview.is-fallback {
  display: grid;
  place-items: center;
  color: #f5f7ff;
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(123, 182, 255, 0.24), rgba(255, 255, 255, 0.08));
}

.mh-profile-inline-form,
.mh-profile-inline-grid {
  display: grid;
  gap: 12px;
}

.mh-profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mh-profile-field {
  display: grid;
  gap: 6px;
}

.mh-profile-field-wide {
  grid-column: 1 / -1;
}

.mh-profile-textarea {
  min-height: 96px;
  resize: vertical;
}

.mh-profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mh-profile-file {
  position: relative;
  display: inline-flex;
}

.mh-profile-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mh-profile-feedback {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(123, 182, 255, 0.12);
  color: #d9ebff;
  font-size: 13px;
  line-height: 1.45;
}

.mh-profile-feedback.is-error {
  background: rgba(255, 140, 140, 0.12);
  color: #ffc1c1;
}

.mh-profile-tip {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--mh-ink-soft);
  line-height: 1.45;
}

.mh-profile-session-list {
  display: grid;
  gap: 10px;
}

.mh-profile-session {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.mh-profile-session.is-current {
  background: rgba(123, 182, 255, 0.09);
}

.mh-profile-session-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.mh-message-body > :first-child {
  margin-top: 0;
}

.mh-message-body > :last-child {
  margin-bottom: 0;
}

.mh-message-body code {
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.mh-message-body a {
  color: #88beff;
  text-decoration: underline;
  cursor: pointer;
}

/* ── Pagination: loading older messages indicator ──────────────────────────── */

.mh-vlist-loading-top {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
  overflow-anchor: none;
}

.mh-vlist-loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(92, 148, 255, 0.25);
  border-top-color: rgba(92, 148, 255, 0.85);
  border-radius: 50%;
  animation: mh-spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes mh-spin {
  to { transform: rotate(360deg); }
}

.mh-unread-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  user-select: none;
  pointer-events: none;
}

.mh-unread-divider::before,
.mh-unread-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(92, 148, 255, 0.35);
}

.mh-unread-divider span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(92, 148, 255, 0.85);
  white-space: nowrap;
}

.mh-message.is-search-hit {
  animation: mh-highlight-flash 2s ease forwards;
}

@keyframes mh-highlight-flash {
  0%   { background: rgba(125, 183, 255, 0.22); }
  50%  { background: rgba(125, 183, 255, 0.1); }
  100% { background: transparent; }
}

.mh-message.is-chat-search-match {
  box-shadow: inset 0 0 0 1px rgba(125, 183, 255, 0.28);
}

.mh-message.is-chat-search-current {
  box-shadow:
    0 0 0 1px rgba(125, 183, 255, 0.48),
    0 0 0 6px rgba(125, 183, 255, 0.12);
}

.mh-toolbar-icon.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.mh-chat-message-search {
  padding: 8px 14px;
  z-index: 2;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-chat-message-search-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-chat-message-search-icon {
  width: 15px;
  height: 15px;
  color: #8d97a8;
}

.mh-chat-message-search .mh-input {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.mh-chat-message-search-status {
  min-width: 54px;
  text-align: center;
  color: rgba(233, 239, 255, 0.68);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.mh-chat-message-search .mh-toolbar-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.mh-chat-message-search .mh-toolbar-icon:disabled {
  opacity: 0.38;
}

@media (max-width: 640px) {
  .mh-profile-form-grid {
    grid-template-columns: 1fr;
  }

  .mh-profile-actions {
    align-items: stretch;
  }

  .mh-profile-session {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .mh-chat-message-search-shell {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .mh-chat-message-search-status {
    order: 4;
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* --- Send animation (kept from redesign) --- */

@keyframes mh-msg-send {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mh-message.is-just-sent {
  animation: mh-msg-send 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Typing indicator bubble */
.mh-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--mh-msg-in, rgba(255, 255, 255, 0.07));
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  margin: 2px 16px 6px;
  width: fit-content;
}

.mh-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(232, 234, 246, 0.5);
  animation: mh-typing-bounce 1.2s ease-in-out infinite;
}

.mh-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.mh-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes mh-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Reply snippet inside bubble */
.mh-message-reply {
  border-left: 3px solid #7bb6ff;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.mh-message-reply-author {
  font-size: 12px;
  font-weight: 600;
  color: #7bb6ff;
  margin-bottom: 2px;
}

.mh-message-reply-text {
  font-size: 13px;
  color: rgba(232, 234, 246, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Chat list enhancements (colored avatars, preview, badges) --- */

/* Colored avatar background via inline style */
.mh-chat-item-avatar.mh-avatar {
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

/* Preview row with badge */
.mh-chat-item-preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mh-chat-item-preview {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

/* Sender prefix in group chats */
.mh-chat-sender-prefix {
  font-weight: 600;
  color: var(--mh-text-primary, #e8eaf6);
}

/* Own-message check icons in preview */
.mh-chat-checks {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: rgba(232, 234, 246, 0.45);
}

.mh-chat-checks.is-read {
  color: #4ade80;
}

.mh-chat-checks .mh-check-icon {
  width: 14px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Unread badge */
.mh-unread-badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #4ade80;
  color: #0d1117;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

/* --- Virtual list sentinels --- */

.mh-vlist-sentinel {
  flex-shrink: 0;
  width: 100%;
  pointer-events: none;
  visibility: hidden;
}

/* --- Online / Typing indicators --- */

.mh-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid var(--mh-surface, #161a22);
  pointer-events: none;
}

.mh-chat-item-avatar,
.mh-chat-identity .mh-avatar {
  position: relative;
}

.mh-online-label {
  color: #4ade80;
  font-weight: 600;
}

.mh-typing-indicator {
  color: #7bb6ff;
  font-weight: 500;
  animation: mh-typing-pulse 1.4s ease-in-out infinite;
}

@keyframes mh-typing-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* --- Attachment preview (composer) --- */

.mh-composer-icon svg,
.mh-attachment-icon svg,
.mh-attachment-file-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.mh-attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 0;
}

.mh-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 260px;
  transition: border-color 0.2s;
}

.mh-attachment-chip.is-uploading {
  border-color: rgba(123, 182, 255, 0.4);
}

.mh-attachment-chip.is-done {
  border-color: rgba(74, 222, 128, 0.4);
}

.mh-attachment-chip.is-error {
  border-color: rgba(255, 140, 140, 0.4);
}

.mh-attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.mh-attachment-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: rgba(232, 234, 246, 0.66);
}

.mh-attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.mh-attachment-name {
  font-size: 12px;
  color: var(--mh-text-primary, #e8eaf6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-attachment-size {
  font-size: 11px;
  color: var(--mh-text-secondary, rgba(232, 234, 246, 0.55));
}

.mh-attachment-remove {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: rgba(232, 234, 246, 0.4);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.mh-attachment-remove:hover {
  color: #ffc1c1;
}

/* --- Attachment display in messages --- */

.mh-message-attachments {
  flex: 0 0 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.mh-attachment-img-link {
  display: block;
  width: 320px;
  max-width: 100%;
}

.mh-attachment-img {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  /* Reserve space before the image loads to prevent layout shift */
  aspect-ratio: 16 / 9;
  max-height: 320px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
}

.mh-attachment-video {
  display: block;
  width: 320px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 240px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.mh-attachment-audio {
  display: block;
  max-width: 280px;
}

.mh-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--mh-text-primary, #e8eaf6);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
}

.mh-attachment-file:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mh-attachment-file-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(232, 234, 246, 0.66);
}

.mh-attachment-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* ── Image-only messages: fill bubble edge-to-edge, overlay time on photo ── */

.mh-message:not(:has(.mh-message-body)) {
  position: relative;
  padding: 0;
  overflow: hidden;
}

.mh-message:not(:has(.mh-message-body)) .mh-message-attachments {
  margin-top: 0;
}

.mh-message:not(:has(.mh-message-body)) .mh-attachment-img {
  display: block;
  border-radius: inherit;
}

.mh-message:not(:has(.mh-message-body)) .mh-attachment-img-link {
  display: block;
}

.mh-message:not(:has(.mh-message-body)) .mh-message-meta {
  position: absolute;
  top: auto;
  bottom: 6px;
  right: 8px;
  margin: 0;
  min-height: auto;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 10px;
  padding: 2px 6px;
  gap: 4px;
  z-index: 1;
}

.mh-message:not(:has(.mh-message-body)) .mh-message-time,
.mh-message:not(:has(.mh-message-body)) .mh-message-checks {
  color: rgba(255, 255, 255, 0.92);
}

.mh-drop-target {
  outline: 2px dashed rgba(123, 182, 255, 0.6);
  outline-offset: -4px;
  background: rgba(123, 182, 255, 0.04) !important;
}

/* --- Create chat modal --- */

.mh-create-chat-form {
  margin-top: 4px;
}

.mh-create-chat-feedback {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 13px;
  margin-bottom: 10px;
}

.mh-create-chat-feedback.is-ok {
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
}

.mh-create-chat-feedback.is-error {
  background: rgba(255, 140, 140, 0.12);
  color: #ffc1c1;
}

.mh-create-chat-member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-bottom: 8px;
}

.mh-create-chat-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(123, 182, 255, 0.14);
  color: #c5deff;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-create-chat-chip-remove {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: rgba(197, 222, 255, 0.6);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.mh-create-chat-chip-remove:hover {
  color: #ffc1c1;
}

.mh-create-chat-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mh-create-chat-add-row .mh-input {
  flex: 1;
  min-width: 0;
}

/* --- Emoji picker --- */

.mh-composer {
  position: relative;
}

.mh-emoji-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: rgba(22, 26, 34, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  z-index: 100;
  overflow: hidden;
  animation: mh-emoji-pop 180ms ease;
}

@keyframes mh-emoji-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.mh-emoji-search {
  padding: 10px 12px 6px;
}

.mh-emoji-search .mh-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.mh-emoji-categories {
  display: flex;
  gap: 2px;
  padding: 0 10px 6px;
  overflow-x: auto;
}

.mh-emoji-cat-btn {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(233, 239, 255, 0.55);
  font-size: 16px;
  cursor: pointer;
  transition: background 120ms ease;
}

.mh-emoji-cat-btn:hover,
.mh-emoji-cat-btn.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f7ff;
}

.mh-emoji-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.mh-emoji-section-label {
  padding: 6px 4px 4px;
  color: rgba(233, 239, 255, 0.45);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mh-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.mh-emoji-btn {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  transition: background 100ms ease, transform 100ms ease;
}

.mh-emoji-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.18);
}

@media (max-width: 720px) {
  .mh-emoji-picker {
    width: calc(100vw - 24px);
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 4px);
  }

  @keyframes mh-emoji-pop {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(8px) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0) scale(1);
    }
  }
}

/* --- Animations --- */

.mh-auth-card,
.mh-auth-aside,
.mh-sidebar,
.mh-info-panel,
.mh-chat-header,
.mh-reply-banner,
.mh-composer,
.mh-admin-hero,
.mh-admin-column,
.mh-admin-wide,
.mh-admin-stat-card {
  animation: mh-fade-up 220ms ease;
}

@keyframes mh-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Pinned chat indicator --- */

.mh-chat-pin-icon {
  display: inline-block;
  color: rgba(123, 182, 255, 0.55);
  flex-shrink: 0;
  margin-left: auto;
}

/* --- Pinned message bar --- */

.mh-pinned-bar {
  /* Remove !important so .mh-hidden (display: none !important) can properly hide the bar */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 5px 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  z-index: 2;
  position: relative;
}

.mh-pinned-bar-title-icon {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.mh-pinned-bar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mh-pinned-bar-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 4px 8px 4px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  outline: none;
  text-align: left;
  position: relative;
  transition: background 150ms;
}

.mh-pinned-bar-content:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mh-pinned-bar-marker {
  position: absolute;
  top: 6px;
  left: 0;
  width: 3px;
  height: calc(100% - 12px);
  min-height: 16px;
  border-radius: 999px;
  background: rgba(123, 182, 255, 0.78);
}

.mh-pinned-bar-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(123, 182, 255, 0.9);
  line-height: 1.2;
}

.mh-pinned-bar-counter {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.65;
}

.mh-pinned-bar-author {
  font-size: 10px;
  line-height: 1.2;
  color: rgba(232, 234, 246, 0.45);
}

.mh-pinned-bar-text {
  font-size: 12px;
  color: rgba(232, 234, 246, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.mh-pinned-bar-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(232, 234, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms, color 150ms;
}

.mh-pinned-bar-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffc1c1;
}

/* --- Remove outer composer box, keep the grey inner row --- */

.mh-composer {
  background: transparent;
  border-top: none;
}

.mh-message.is-pinned {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.mh-message-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: rgba(232, 234, 246, 0.56);
}

.mh-message-pin-icon {
  width: 13px;
  height: 13px;
}

/* --- Chat header button reset --- */

button.mh-chat-identity {
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 4px 8px;
  border-radius: 0;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

/* --- Chat info modal overlay --- */

.mh-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mh-info-overlay.is-open {
  opacity: 1;
}

.mh-info-modal {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  max-height: min(900px, calc(100vh - 32px));
  overflow-y: auto;
  background: var(--mh-surface, #1a1e28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.94) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mh-info-overlay.is-open .mh-info-modal {
  transform: scale(1) translateY(0);
}

.mh-info-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 234, 246, 0.7);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms;
  z-index: 1;
}

.mh-info-modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #e8eaf6;
}

.mh-info-modal-body {
  padding: 36px 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Avatar */
.mh-info-modal-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--avatar-color, #2196F3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.mh-info-modal-avatar .mh-avatar-fallback {
  font-size: 38px;
  font-weight: 700;
  color: #fff;
}

.mh-info-modal-avatar .mh-avatar-fallback.is-icon .hgi-stroke {
  font-size: 0.8em;
}

.mh-info-modal-online {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid var(--mh-surface, #1a1e28);
  z-index: 2;
}

.mh-info-modal-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--mh-text-primary, #e8eaf6);
  text-align: center;
  line-height: 1.2;
}

.mh-info-modal-username {
  font-size: 14px;
  color: #7bb6ff;
  text-align: center;
}

.mh-info-modal-status {
  font-size: 13px;
  color: var(--mh-text-secondary, rgba(232, 234, 246, 0.55));
  text-align: center;
  margin-bottom: 4px;
}

/* Detail rows (bio, phone) */
.mh-info-details {
  width: 100%;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mh-info-detail-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.mh-info-detail-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 234, 246, 0.4);
}

.mh-info-detail-value {
  font-size: 14px;
  color: var(--mh-text-primary, #e8eaf6);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Members section */
.mh-info-section {
  width: 100%;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 16px;
}

.mh-info-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 234, 246, 0.4);
  margin-bottom: 10px;
}

.mh-info-members-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 480px;
  overflow-y: auto;
}

.mh-info-member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 12px;
  transition: background 120ms;
}

.mh-info-member:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mh-info-member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--avatar-color, #2196F3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.mh-info-member-avatar .mh-avatar-fallback {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.mh-info-member-avatar .mh-avatar-fallback.is-icon .hgi-stroke {
  font-size: 0.82em;
}

.mh-info-member-info {
  flex: 1;
  min-width: 0;
}

.mh-info-member-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--mh-text-primary, #e8eaf6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-info-member-username {
  font-size: 13px;
  color: rgba(232, 234, 246, 0.45);
}

.mh-info-member-badge {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.mh-info-badge-self,
.mh-info-badge-owner,
.mh-info-badge-admin {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.mh-info-badge-self {
  background: rgba(123, 182, 255, 0.15);
  color: #7bb6ff;
}

.mh-info-badge-owner {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.mh-info-badge-admin {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

/* --- HugeIcons sizing --- */

.mh-toolbar-icon .hgi-stroke,
.mh-toolbar-icon > i.hgi-stroke {
  font-size: 18px;
  display: block;
  line-height: 1;
}

.mh-composer-icon .hgi-stroke,
.mh-composer-icon > i.hgi-stroke {
  font-size: 18px;
  display: block;
  line-height: 1;
}

.mh-send-button .mh-send-icon {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) invert(1);
}

.mh-info-modal-close .hgi-stroke,
.mh-info-modal-close > i.hgi-stroke {
  font-size: 16px;
  display: block;
  line-height: 1;
}

/* In-chat search shell icon (grid item, no abs positioning needed) */
i.mh-chat-message-search-icon {
  font-size: 16px;
  color: rgba(233, 239, 255, 0.45);
  position: static;
  display: block;
  line-height: 1;
}

/* Sidebar chat list search icon — needs to stay absolutely positioned */
i.mh-chat-search-icon {
  position: absolute;
  display: block;
  font-size: 14px;
  line-height: 1;
  color: #8791a2;
}

.mh-rail-link .hgi-stroke,
.mh-rail-link > i.hgi-stroke {
  font-size: 20px;
  display: block;
  line-height: 1;
}

/* --- Chat list rise animation --- */

@keyframes mh-chat-rise {
  from {
    opacity: 0.6;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mh-chat-item.is-risen {
  animation: mh-chat-rise 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* --- Folder rail with label --- */

.mh-folder-link-labeled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  height: auto;
  min-height: 52px;
}

.mh-folder-rail-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  color: rgba(233, 239, 255, 0.6);
  max-width: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.mh-folder-link-labeled.is-active .mh-folder-rail-label {
  color: rgba(233, 239, 255, 0.95);
}

/* --- Shared form helpers used in folder dialog --- */

.mh-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mh-field-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(233, 239, 255, 0.55);
  letter-spacing: 0.04em;
}

/* --- Folder dialog --- */

.mh-folder-dialog {
  width: min(480px, calc(100vw - 24px));
}

.mh-folder-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 0 4px;
}

.mh-folder-icon-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mh-folder-icon-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.mh-folder-icon-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mh-folder-icon-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(233, 239, 255, 0.4);
}

.mh-folder-icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mh-folder-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  color: rgba(233, 239, 255, 0.7);
  font-size: 0;
}

.mh-folder-icon-btn i {
  font-size: 18px;
  display: block;
}

.mh-folder-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(233, 239, 255, 0.95);
}

.mh-folder-icon-btn.is-selected {
  background: rgba(123, 182, 255, 0.18);
  border-color: #7bb6ff;
  color: #9ccaff;
}

.mh-folder-dialog-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* --- Folder drag & drop --- */

.mh-folder-link[draggable="true"] {
  cursor: grab;
}

.mh-folder-link[draggable="true"]:active {
  cursor: grabbing;
}

.mh-folder-rail.is-reordering .mh-folder-link {
  transition: transform 180ms ease;
}

/* --- Pinned chat drag & drop --- */

[data-pinned="true"] {
  cursor: grab;
}

[data-pinned="true"]:active {
  cursor: grabbing;
}

.mh-chat-list.is-reordering [data-pinned="true"] {
  transition: transform 180ms ease;
}

/* --- Media lightbox --- */

body.mh-lightbox-open {
  overflow: hidden;
}

.mh-lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mh-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.mh-lightbox-media {
  position: relative;
  z-index: 1;
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mh-lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 80px);
  border-radius: 8px;
  object-fit: contain;
  display: block;
}

.mh-lightbox-video {
  max-width: 100%;
  max-height: calc(100vh - 80px);
  border-radius: 8px;
  display: block;
  outline: none;
}

.mh-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.mh-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mh-lightbox-close svg {
  width: 20px;
  height: 20px;
}

.mh-lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.mh-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mh-lightbox-arrow svg {
  width: 22px;
  height: 22px;
}

.mh-lightbox-prev { left: 16px; }
.mh-lightbox-next { right: 16px; }

.mh-lightbox-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  pointer-events: none;
}

.mh-attachment-video-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

/* --- Upload progress animation --- */

.mh-pending-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.mh-pending-media-item {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.mh-pending-media-item img,
.mh-pending-media-item .mh-pending-media-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mh-pending-media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
}

.mh-pending-media-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.mh-pending-media-spinner::after {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: mh-spin 0.7s linear infinite;
}

@keyframes mh-spin {
  to { transform: rotate(360deg); }
}

/* --- Forward chat picker --- */

.mh-forward-picker {
  max-height: 420px;
  display: flex;
  flex-direction: column;
}

.mh-forward-picker-search {
  margin-bottom: 10px;
}

.mh-forward-picker-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mh-forward-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  color: inherit;
  width: 100%;
  text-align: left;
}

.mh-forward-picker-row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.mh-forward-picker-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.mh-forward-picker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mh-forward-picker-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-forward-sent {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  padding: 16px 0;
}

/* --- Context menu submenu --- */

.mh-context-menu-item.has-submenu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mh-context-submenu-arrow {
  font-size: 16px;
  line-height: 1;
  opacity: 0.55;
  margin-left: auto;
  flex-shrink: 0;
}

.mh-context-submenu {
  position: fixed;
  z-index: 61;
}

.mh-context-submenu-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mh-context-submenu-icon {
  font-size: 15px;
  opacity: 0.7;
  flex-shrink: 0;
}

.mh-context-submenu-folder-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.6;
}

.mh-context-submenu-folder-icon svg {
  width: 15px;
  height: 15px;
}

.mh-context-submenu-check {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
  color: #7bb6ff;
}

/* --- Message row wrapper (Telegram-style selection) --- */

.mh-msg-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
  position: relative;
  transition: background 0.12s ease;
}

/* Checkbox column — hidden until selection mode */
.mh-msg-cb-wrap {
  width: 0;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.is-selection-mode .mh-msg-cb-wrap {
  width: 44px;
}

/* Checkbox button */
.mh-msg-cb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mh-msg-cb:focus-visible {
  outline: 2px solid rgba(92, 148, 255, 0.5);
  outline-offset: 2px;
}

/* Ring (unchecked) */
.mh-cb-ring {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  transition: opacity 0.15s ease;
}

.mh-cb-ring svg {
  width: 22px;
  height: 22px;
}

.mh-msg-row.is-selected .mh-cb-ring {
  opacity: 0;
}

/* Check (selected) */
.mh-cb-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mh-cb-check svg {
  width: 22px;
  height: 22px;
}

.mh-msg-row.is-selected .mh-cb-check {
  opacity: 1;
  transform: scale(1);
}

/* Row selected highlight */
.mh-msg-row.is-selected {
  background: rgba(92, 148, 255, 0.10);
}

/* Outgoing messages stay right-aligned inside the row */
.mh-msg-row.outgoing > .mh-message {
  margin-left: auto;
  align-self: auto;
}

.mh-msg-row.incoming > .mh-message {
  align-self: auto;
}

/* Reset old bubble selection style (replaced by row highlight) */
.mh-message.is-selected {
  background: inherit !important;
  box-shadow: none !important;
}

.mh-message.outgoing.is-selected {
  box-shadow: none !important;
}

/* --- Message selection action bar --- */

.mh-selection-bar {
  grid-row: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(20, 22, 28, 0.98);
  min-height: 56px;
}

.mh-selection-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mh-selection-bar-cancel {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.mh-selection-bar-cancel:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mh-selection-bar-cancel svg {
  width: 16px;
  height: 16px;
}

.mh-selection-bar-count {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}

.mh-selection-bar-count strong {
  color: #fff;
}

.mh-selection-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mh-selection-bar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.mh-selection-bar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mh-selection-bar-btn.is-danger {
  color: #ff8d8d;
}

.mh-selection-bar-btn.is-danger:hover {
  background: rgba(255, 80, 80, 0.14);
}

.mh-selection-bar-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* disable text selection during message drag */
.mh-messages.is-drag-selecting {
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Admin panel in chat-info ---- */

.mh-admin-section {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 1rem;
}

.mh-admin-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  font-size: 14px;
  color: rgba(233, 239, 255, 0.88);
  cursor: pointer;
  user-select: none;
}

.mh-admin-toggle {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease;
  flex-shrink: 0;
}

.mh-admin-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.mh-admin-toggle:checked {
  background: #4fa8ff;
}

.mh-admin-toggle:checked::before {
  transform: translateX(16px);
}

.mh-admin-invite-block {
  margin-top: 0.75rem;
}

.mh-admin-invite-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(233, 239, 255, 0.5);
  margin-bottom: 0.45rem;
}

.mh-admin-invite-url {
  font-size: 12px;
  color: #7bb6ff;
  word-break: break-all;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: rgba(123, 182, 255, 0.08);
  margin-bottom: 0.5rem;
}

.mh-admin-invite-actions {
  display: flex;
  gap: 0.5rem;
}

.mh-admin-btn {
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(233, 239, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease;
}

.mh-admin-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
}

.mh-admin-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mh-admin-btn-danger {
  border-color: rgba(255, 90, 90, 0.3);
  color: #ff8080;
}

.mh-admin-btn-danger:hover:not(:disabled) {
  background: rgba(255, 80, 80, 0.12);
}

/* Member action dropdown */

.mh-member-actions-wrap {
  position: relative;
}

.mh-member-actions-btn {
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(233, 239, 255, 0.55);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: background 140ms ease, color 140ms ease;
}

.mh-member-actions-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(233, 239, 255, 0.9);
}

.mh-member-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 200;
  min-width: 180px;
  border-radius: 14px;
  background: #1e2540;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.mh-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  background: transparent;
  color: rgba(233, 239, 255, 0.88);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.mh-dropdown-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
}

.mh-dropdown-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mh-dropdown-item-danger {
  color: #ff8080;
}

.mh-dropdown-item-danger:hover:not(:disabled) {
  background: rgba(255, 80, 80, 0.1);
}

/* Role / status badges */

.mh-info-badge-admin {
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(123, 182, 255, 0.15);
  color: #7bb6ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mh-info-badge-editor {
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(160, 230, 150, 0.15);
  color: #7ecf74;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mh-info-badge-muted {
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(255, 200, 80, 0.14);
  color: #f0c050;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mh-info-member-muted-label {
  font-size: 11px;
  color: #f0c050;
  margin-top: 1px;
}

/* Ban list */

.mh-ban-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-ban-item-info {
  min-width: 0;
  flex: 1;
}

.mh-ban-item-id {
  font-size: 12px;
  color: rgba(233, 239, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-ban-item-reason {
  font-size: 11px;
  color: rgba(233, 239, 255, 0.45);
  margin-top: 2px;
}

/* Admin error banner */

.mh-admin-error-banner {
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 80, 80, 0.14);
  color: #ff8080;
  font-size: 13px;
  margin-bottom: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════
   Right Panel — Telegram-style slide-in info column
   ═══════════════════════════════════════════════════════════ */

/* ── Panel shell ──────────────────────────────────────────── */

.mh-chat-stage {
  position: relative;
}

.mh-right-panel {
  width: 0;
  min-width: 0;
  flex-shrink: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--mh-surface, #1a1e28);
  border-left: 0px solid rgba(255, 255, 255, 0.06);
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.26s cubic-bezier(0.4, 0, 0.2, 1),
              border-left-width 0s 0.26s;
  will-change: width;
}

.mh-chat-stage.is-right-panel-open .mh-right-panel {
  width: 360px;
  min-width: 360px;
  border-left-width: 1px;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.26s cubic-bezier(0.4, 0, 0.2, 1),
              border-left-width 0s;
}

/* ── Header ───────────────────────────────────────────────── */

.mh-right-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  min-height: 52px;
}

.mh-rp-back-btn,
.mh-rp-close-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(232, 234, 246, 0.6);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms, color 140ms;
  flex-shrink: 0;
}

.mh-rp-back-btn:hover,
.mh-rp-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e8eaf6;
}

.mh-rp-header-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: #e8eaf6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-rp-edit-btn {
  font-size: 13px;
  font-weight: 600;
  color: #7bb6ff;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 140ms;
}

.mh-rp-edit-btn:hover {
  background: rgba(123, 182, 255, 0.1);
}

/* ── Body ─────────────────────────────────────────────────── */

@keyframes mh-rp-enter-right {
  from { transform: translateX(36px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes mh-rp-enter-left {
  from { transform: translateX(-24px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.mh-right-panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.mh-right-panel-body.mh-rp-slide-forward {
  animation: mh-rp-enter-right 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.mh-right-panel-body.mh-rp-slide-back {
  animation: mh-rp-enter-left 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Hero block (avatar + name + status) ─────────────────── */

.mh-rp-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 20px;
  gap: 4px;
  text-align: center;
}

.mh-rp-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--avatar-color, #2196F3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.mh-rp-avatar .mh-avatar-fallback {
  font-size: 34px;
  font-weight: 700;
  color: #fff;
}

.mh-rp-name {
  font-size: 19px;
  font-weight: 700;
  color: #e8eaf6;
  line-height: 1.2;
  word-break: break-word;
}

.mh-rp-username {
  font-size: 14px;
  color: #7bb6ff;
}

.mh-rp-status-line {
  font-size: 13px;
  color: rgba(232, 234, 246, 0.5);
  margin-top: 2px;
}

/* ── Action buttons row ───────────────────────────────────── */

.mh-rp-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 4px 20px 16px;
}

.mh-rp-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(232, 234, 246, 0.85);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms;
  min-width: 68px;
}

.mh-rp-action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.11);
}

.mh-rp-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mh-rp-action-btn .hgi-stroke {
  font-size: 20px;
}

/* ── Info rows (username, phone, bio) ─────────────────────── */

.mh-rp-info-rows {
  padding: 0 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
}

.mh-rp-info-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.mh-rp-info-row:last-child {
  border-bottom: none;
}

.mh-rp-info-row-value {
  font-size: 14px;
  color: #e8eaf6;
  line-height: 1.4;
  word-break: break-word;
}

.mh-rp-username-value {
  color: #7bb6ff;
}

.mh-rp-info-row-label {
  font-size: 11px;
  color: rgba(232, 234, 246, 0.4);
  margin-top: 2px;
}

/* ── Tabs bar ─────────────────────────────────────────────── */

.mh-rp-tabs-bar {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
  scrollbar-width: none;
}

.mh-rp-tabs-bar::-webkit-scrollbar {
  display: none;
}

.mh-rp-tab {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(232, 234, 246, 0.55);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 140ms, border-color 140ms;
  white-space: nowrap;
}

.mh-rp-tab:hover {
  color: rgba(232, 234, 246, 0.85);
}

.mh-rp-tab.is-active {
  color: #7bb6ff;
  border-bottom-color: #7bb6ff;
}

/* ── Tab content ──────────────────────────────────────────── */

.mh-rp-tab-content {
  padding: 8px 0;
}

.mh-rp-placeholder {
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: rgba(232, 234, 246, 0.35);
}

/* ── Member list in right panel ──────────────────────────── */

.mh-rp-member {
  cursor: pointer;
  padding: 8px 16px;
}

.mh-rp-member:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Edit form ────────────────────────────────────────────── */

.mh-rp-edit-form {
  padding: 8px 0 32px;
}

/* ── Edit screen top (avatar + name) ────────────────────── */

.mh-rp-edit-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mh-rp-edit-name-wrap {
  flex: 1;
  min-width: 0;
}

.mh-rp-edit-name-wrap .mh-input {
  width: 100%;
}

/* ── Edit screen nav rows ────────────────────────────────── */

.mh-rp-nav-section {
  padding: 0;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-rp-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.12s;
  gap: 8px;
  user-select: none;
}

.mh-rp-nav-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mh-rp-nav-row + .mh-rp-nav-row {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.mh-rp-nav-row-label {
  flex: 1;
  font-size: 14px;
  color: rgba(232, 234, 246, 0.9);
}

.mh-rp-nav-row-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.mh-rp-nav-row-value {
  font-size: 13px;
  color: rgba(232, 234, 246, 0.4);
}

.mh-rp-nav-row .hgi-arrow-right-01,
.mh-rp-nav-row-right .hgi-arrow-right-01 {
  color: rgba(232, 234, 246, 0.25);
  font-size: 14px;
  flex-shrink: 0;
}

.mh-rp-nav-row-soon {
  cursor: default;
}

.mh-rp-nav-row-soon:hover {
  background: none;
}

.mh-rp-nav-row-soon .mh-rp-nav-row-label {
  color: rgba(232, 234, 246, 0.4);
}

/* ── Edit screen avatar section ──────────────────────────── */

.mh-rp-edit-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-rp-edit-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}

.mh-rp-edit-avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.mh-rp-edit-avatar-btn {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  border: none;
  cursor: pointer;
  color: #fff;
}

.mh-rp-edit-avatar-wrap:hover .mh-rp-edit-avatar-btn {
  opacity: 1;
}

.mh-rp-edit-avatar-btn svg {
  width: 22px;
  height: 22px;
}

.mh-rp-edit-hint {
  font-size: 12px;
  color: rgba(232, 234, 246, 0.4);
  margin-top: 8px;
}

/* ── Invite links list ───────────────────────────────────── */

.mh-rp-invite-list-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-rp-invite-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mh-rp-invite-card {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-rp-invite-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.mh-rp-invite-card-name {
  font-size: 14px;
  font-weight: 500;
  color: rgba(232, 234, 246, 0.9);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-rp-invite-card-url {
  font-size: 12px;
  color: rgba(92, 148, 255, 0.8);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-rp-invite-card-meta {
  font-size: 12px;
  color: rgba(232, 234, 246, 0.4);
  margin-bottom: 10px;
}

.mh-rp-invite-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mh-invite-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mh-invite-badge-active {
  background: rgba(52, 199, 89, 0.18);
  color: #34c759;
}

.mh-invite-badge-inactive {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 234, 246, 0.4);
}

.mh-invite-badge-expired {
  background: rgba(255, 69, 58, 0.18);
  color: #ff453a;
}

.mh-rp-invite-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  color: rgba(232, 234, 246, 0.35);
  text-align: center;
}

.mh-rp-invite-empty i {
  font-size: 40px;
  margin-bottom: 4px;
}

/* ── Invite link preset buttons ──────────────────────────── */

.mh-invite-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mh-invite-preset {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(232, 234, 246, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}

.mh-invite-preset:hover {
  background: rgba(255, 255, 255, 0.06);
}

.mh-invite-preset.is-active {
  background: rgba(92, 148, 255, 0.2);
  border-color: rgba(92, 148, 255, 0.5);
  color: #7aacff;
}

.mh-rp-edit-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mh-rp-edit-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 234, 246, 0.4);
  margin-bottom: 10px;
}

.mh-rp-edit-label {
  font-size: 11px;
  color: rgba(232, 234, 246, 0.45);
  margin-bottom: 6px;
}

.mh-rp-edit-placeholders {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mh-rp-placeholder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  font-size: 14px;
  color: rgba(232, 234, 246, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: default;
}

.mh-rp-placeholder-row:last-child {
  border-bottom: none;
}

.mh-rp-placeholder-soon {
  font-size: 11px;
  color: rgba(232, 234, 246, 0.3);
}

.mh-rp-delete-btn {
  width: 100%;
  justify-content: center;
}

.mh-rp-edit-done-row {
  padding: 16px;
  display: flex;
  justify-content: flex-end;
}

/* ── Profile forms inside right panel ────────────────────── */

.mh-rp-profile-forms {
  padding: 0 0 32px;
}

.mh-rp-profile-forms .mh-rp-edit-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
  .mh-chat-stage.is-right-panel-open .mh-right-panel {
    width: 300px;
    min-width: 300px;
  }
}

@media (max-width: 720px) {
  .mh-chat-stage.is-right-panel-open .mh-right-panel {
    position: absolute;
    inset: 0;
    width: 100% !important;
    min-width: 0 !important;
    z-index: 100;
  }
}

/* ── Media tab grid ───────────────────────────────────────── */

.mh-rp-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 4px 0;
}

.mh-rp-media-thumb {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}

.mh-rp-media-thumb img,
.mh-rp-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Files list ───────────────────────────────────────────── */

.mh-rp-file-list {
  padding: 4px 0;
}

.mh-rp-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}

.mh-rp-file-item:hover {
  background: rgba(255,255,255,0.04);
}

.mh-rp-file-icon {
  font-size: 20px;
  color: var(--mh-accent, #4e9eff);
  flex-shrink: 0;
}

.mh-rp-file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-rp-file-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
}

/* ── Links list ───────────────────────────────────────────── */

.mh-rp-link-list {
  padding: 4px 0;
}

.mh-rp-link-item {
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.mh-rp-link-item:hover {
  background: rgba(255,255,255,0.04);
}

.mh-rp-link-url {
  font-size: 12px;
  color: var(--mh-accent, #4e9eff);
  word-break: break-all;
}

.mh-rp-link-date {
  font-size: 11px;
  margin-top: 2px;
}

/* ── Audio / Voice list ───────────────────────────────────── */

.mh-rp-audio-list {
  padding: 4px 0;
}

.mh-rp-audio-item {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.mh-rp-audio-player {
  width: 100%;
  height: 32px;
  accent-color: var(--mh-accent, #4e9eff);
}

.mh-rp-audio-meta {
  font-size: 11px;
  margin-top: 4px;
}

/* ── Mutual groups list ───────────────────────────────────── */

.mh-rp-group-list {
  padding: 4px 0;
}

.mh-rp-group-item {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s;
}

.mh-rp-group-item:hover {
  background: rgba(255,255,255,0.04);
}

.mh-rp-group-name {
  font-size: 13px;
  font-weight: 500;
}

/* ── Add member panel ─────────────────────────────────────── */

.mh-rp-add-member {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}

.mh-rp-add-member-results {
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.mh-rp-add-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.mh-rp-add-result-item:hover {
  background: rgba(255,255,255,0.06);
}

.mh-rp-add-result-name {
  font-size: 13px;
  font-weight: 500;
}

.mh-rp-tab-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255,255,255,0.3);
  font-size: 13px;
}

/* ── Theme variables ─────────────────────────────────────────────────────────── */

:root {
  --mh-bg: #0d1117;
  --mh-surface: #1a1e28;
  --mh-surface-2: rgba(255, 255, 255, 0.04);
  --mh-surface-3: rgba(255, 255, 255, 0.07);
  --mh-text-primary: #e8eaf6;
  --mh-text-secondary: rgba(232, 234, 246, 0.55);
  --mh-text-muted: rgba(232, 234, 246, 0.35);
  --mh-border: rgba(255, 255, 255, 0.07);
  --mh-accent: #7bb6ff;
  --mh-ink-soft: rgba(232, 234, 246, 0.55);
  --mh-danger: #ff6b6b;
}

html[data-theme="light"] {
  --mh-bg: #eef1f5;
  --mh-surface: #ffffff;
  --mh-surface-2: rgba(0, 0, 0, 0.04);
  --mh-surface-3: rgba(0, 0, 0, 0.07);
  --mh-text-primary: #1a1a2e;
  --mh-text-secondary: rgba(26, 26, 46, 0.6);
  --mh-text-muted: rgba(26, 26, 46, 0.38);
  --mh-border: rgba(0, 0, 0, 0.08);
  --mh-accent: #2d7bf4;
  --mh-ink: #1a1a2e;
  --mh-ink-soft: rgba(26, 26, 46, 0.55);
  --mh-danger: #e03535;
}

/* ── Light theme overrides ───────────────────────────────────────────────── */

/* App shell */
html[data-theme="light"] .mh-runtime {
  background: var(--mh-bg);
}

html[data-theme="light"] .mh-messenger-shell {
  background: var(--mh-bg);
}

/* Panels: remove dark box-shadow and fix border */
html[data-theme="light"] .mh-panel {
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: none;
}

/* Main column backgrounds */
html[data-theme="light"] .mh-nav-rail {
  background: #f4f6fa;
  border-right-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-chat-pane {
  background: #f8f9fc;
  border-right-color: rgba(0, 0, 0, 0.07);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-chat-stage {
  background: #edf1f7;
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-chat-header {
  background: #ffffff;
  border-bottom-color: rgba(0, 0, 0, 0.07);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-right-panel,
html[data-theme="light"] .mh-right-panel-header {
  background: #ffffff;
  color: var(--mh-text-primary);
}

/* Chat list items */
html[data-theme="light"] .mh-chat-item {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-chat-item:hover,
html[data-theme="light"] .mh-chat-item:focus-visible {
  background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .mh-chat-item.is-active {
  background: rgba(45, 123, 244, 0.1);
}

html[data-theme="light"] .mh-chat-item-time {
  color: rgba(26, 26, 46, 0.45);
}

html[data-theme="light"] .mh-chat-item-preview,
html[data-theme="light"] .mh-chat-item-subline {
  color: rgba(26, 26, 46, 0.5);
}

html[data-theme="light"] .mh-chat-title {
  color: var(--mh-text-primary);
}

/* Nav rail */
html[data-theme="light"] .mh-rail-link {
  color: rgba(26, 26, 46, 0.5);
}

html[data-theme="light"] .mh-rail-link:hover {
  color: var(--mh-text-primary);
  background: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-rail-link.is-active {
  color: var(--mh-accent);
  background: rgba(45, 123, 244, 0.1);
}

/* Sidebar labels */
html[data-theme="light"] .mh-brand-mini,
html[data-theme="light"] .mh-sidebar-caption {
  color: var(--mh-text-primary);
}

/* Chat pane head */
html[data-theme="light"] .mh-chat-pane-head {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

/* Search input */
html[data-theme="light"] .mh-input {
  background: rgba(0, 0, 0, 0.05);
  color: var(--mh-text-primary);
  border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .mh-input::placeholder {
  color: var(--mh-text-muted);
}

/* Chat header toolbar */
html[data-theme="light"] .mh-toolbar-icon,
html[data-theme="light"] .mh-composer-icon {
  color: rgba(26, 26, 46, 0.5);
}

html[data-theme="light"] .mh-toolbar-icon:hover,
html[data-theme="light"] .mh-composer-icon:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-chat-back {
  color: rgba(26, 26, 46, 0.55);
}

/* Pinned bar */
html[data-theme="light"] .mh-pinned-bar {
  background: rgba(0, 0, 0, 0.02);
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-pinned-bar-text,
html[data-theme="light"] .mh-composer-mode-text {
  color: rgba(26, 26, 46, 0.7);
}

html[data-theme="light"] .mh-pinned-bar-close {
  color: rgba(26, 26, 46, 0.45);
}

/* Messages area */
html[data-theme="light"] .mh-messages {
  background: #e8edf4;
}

html[data-theme="light"] .mh-message {
  background: #ffffff;
  color: var(--mh-text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .mh-message.outgoing {
  background: #cce3ff;
  color: #0d2040;
}

html[data-theme="light"] .mh-message-author,
html[data-theme="light"] .mh-message-time,
html[data-theme="light"] .mh-message-edited {
  color: rgba(26, 26, 46, 0.45);
}

html[data-theme="light"] .mh-message-checks {
  color: rgba(26, 26, 46, 0.4);
}

html[data-theme="light"] .mh-message-checks.is-read {
  color: var(--mh-accent);
}

html[data-theme="light"] .mh-message-reply-text {
  color: rgba(26, 26, 46, 0.6);
}

/* Composer */
html[data-theme="light"] .mh-composer {
  background: #ffffff;
  border-top-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-message-input {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-message-input::placeholder {
  color: var(--mh-text-muted);
}

/* Date pills */
html[data-theme="light"] .mh-date-divider span {
  background: rgba(190, 205, 220, 0.85);
  color: rgba(26, 26, 46, 0.7);
}

html[data-theme="light"] .mh-floating-date {
  background: rgba(190, 205, 220, 0.9);
  color: rgba(26, 26, 46, 0.8);
}

/* Online dot */
html[data-theme="light"] .mh-online-dot {
  border-color: var(--mh-surface);
}

/* Buttons */
html[data-theme="light"] .mh-button.secondary,
html[data-theme="light"] .mh-button.ghost {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-button.secondary:hover,
html[data-theme="light"] .mh-button.ghost:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* Right panel navigation buttons */
html[data-theme="light"] .mh-rp-back-btn,
html[data-theme="light"] .mh-rp-close-btn {
  color: rgba(26, 26, 46, 0.55);
}

html[data-theme="light"] .mh-rp-back-btn:hover,
html[data-theme="light"] .mh-rp-close-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-rp-header-title {
  color: var(--mh-text-primary);
}

/* Right panel content */
html[data-theme="light"] .mh-rp-name {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-rp-status-line {
  color: var(--mh-text-secondary);
}

html[data-theme="light"] .mh-rp-action-btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-rp-action-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.09);
}

html[data-theme="light"] .mh-rp-info-rows {
  border-top-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-rp-info-row {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .mh-rp-info-row-value {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-rp-info-row-label {
  color: rgba(26, 26, 46, 0.4);
}

html[data-theme="light"] .mh-rp-tabs-bar {
  border-top-color: rgba(0, 0, 0, 0.07);
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-rp-tab {
  color: rgba(26, 26, 46, 0.55);
}

html[data-theme="light"] .mh-rp-tab:hover {
  color: rgba(26, 26, 46, 0.85);
}

html[data-theme="light"] .mh-rp-placeholder {
  color: rgba(26, 26, 46, 0.35);
}

html[data-theme="light"] .mh-rp-member:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Profile strip / panel blocks */
html[data-theme="light"] .mh-profile-strip,
html[data-theme="light"] .mh-panel-block,
html[data-theme="light"] .mh-admin-stat-card,
html[data-theme="light"] .mh-admin-hero {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .mh-empty-state {
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--mh-text-secondary);
}

/* Context menu */
html[data-theme="light"] .mh-context-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .mh-context-menu-item {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-context-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Edit menu (new group/channel dropdown) */
html[data-theme="light"] .mh-edit-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .mh-edit-menu-item {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-edit-menu-item i {
  color: rgba(26, 26, 46, 0.5);
}

html[data-theme="light"] .mh-edit-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Search section */
html[data-theme="light"] .mh-search-section-title {
  color: rgba(26, 26, 46, 0.45);
}

/* Settings list */
html[data-theme="light"] .mh-ps-hero {
  background: rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .mh-ps-hero-row:hover {
  background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .mh-ps-hero-name {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-ps-hero-phone,
html[data-theme="light"] .mh-ps-hero-username {
  color: var(--mh-text-secondary);
}

html[data-theme="light"] .mh-ps-hero-chevron,
html[data-theme="light"] .mh-ps-item-chevron {
  color: rgba(26, 26, 46, 0.3);
}

html[data-theme="light"] .mh-ps-settings {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 14px;
}

html[data-theme="light"] .mh-ps-item {
  border-top-color: rgba(0, 0, 0, 0.06);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-ps-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .mh-ps-item-icon {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .mh-ps-back-btn {
  color: rgba(26, 26, 46, 0.55);
}

html[data-theme="light"] .mh-ps-back-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-ps-title {
  color: var(--mh-text-primary);
}

/* Profile edit (settings content screens) */
html[data-theme="light"] .mh-pe-section-head {
  color: rgba(26, 26, 46, 0.4);
}

html[data-theme="light"] .mh-pe-row {
  border-top-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .mh-pe-row-action {
  border-top-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .mh-pe-hint {
  color: rgba(26, 26, 46, 0.4);
}

html[data-theme="light"] .mh-pe-session {
  border-top-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .mh-pe-session-icon {
  color: rgba(26, 26, 46, 0.38);
}

html[data-theme="light"] .mh-pe-session-meta {
  color: rgba(26, 26, 46, 0.5);
}

html[data-theme="light"] .mh-pe-empty {
  color: rgba(26, 26, 46, 0.35);
}

html[data-theme="light"] .mh-pe-feedback {
  background: rgba(45, 123, 244, 0.08);
  color: rgba(26, 26, 46, 0.8);
}

html[data-theme="light"] .mh-pe-feedback.is-error {
  background: rgba(224, 53, 53, 0.08);
  color: #c02020;
}

/* Misc text */
html[data-theme="light"] .mh-muted-text {
  color: var(--mh-text-secondary);
}

html[data-theme="light"] .mh-title-text {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-orb-a,
html[data-theme="light"] .mh-orb-b {
  opacity: 0.06;
}

/* Light theme: chat main area (fixes dark background showing as black border) */
html[data-theme="light"] .mh-chat-main {
  background: #edf1f7;
}

/* Light theme: message composer row */
html[data-theme="light"] .mh-composer-row {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .mh-message-input {
  color: var(--mh-text-primary);
}

html[data-theme="light"] .mh-message-input::placeholder {
  color: var(--mh-text-muted);
}

/* Light theme: folder rail labels */
html[data-theme="light"] .mh-folder-rail-label {
  color: rgba(26, 26, 46, 0.55);
}

html[data-theme="light"] .mh-folder-link-labeled.is-active .mh-folder-rail-label {
  color: var(--mh-accent);
}

/* ── Red logout button ───────────────────────────────────────────────────────── */

#logoutBtn {
  color: var(--mh-danger, #ff6b6b) !important;
}

#logoutBtn:hover {
  background: rgba(255, 107, 107, 0.1) !important;
}

html[data-theme="light"] #logoutBtn:hover {
  background: rgba(224, 53, 53, 0.1) !important;
}

/* ── Settings pane head: reset caption margin so it centres with the back button ── */

#settingsPaneHead .mh-sidebar-caption {
  margin-top: 0;
}

/* ── Nav rail stacking: must be above chat pane so the edit menu isn't clipped ── */

.mh-nav-rail {
  position: relative;
  z-index: 2;
}

/* ── Edit button & dropdown ──────────────────────────────────────────────────── */

.mh-edit-menu-wrap {
  position: relative;
}

.mh-edit-menu {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 0;
  z-index: 100;
  background: var(--mh-surface, #1a1e28);
  border: 1px solid var(--mh-border, rgba(255,255,255,0.07));
  border-radius: 16px;
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.32);
  animation: mh-fade-up 160ms ease;
}

.mh-edit-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--mh-text-primary, #e8eaf6);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.mh-edit-menu-item:hover {
  background: var(--mh-surface-2, rgba(255,255,255,0.06));
}

.mh-edit-menu-item i {
  font-size: 15px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
}

/* ── Settings list in chatPane (Telegram-style) ─────────────────────────────── */

.mh-settings-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mh-settings-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.mh-settings-shortcut-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mh-settings-kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--mh-surface-2, rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  font-family: monospace;
  white-space: nowrap;
  color: var(--mh-text-primary, #e8eaf6);
  min-width: 120px;
  justify-content: center;
}

.mh-rp-invite-text {
  padding: 10px 12px;
  background: var(--mh-surface-2, rgba(255,255,255,0.04));
  border-radius: 12px;
  font-size: 13px;
  color: var(--mh-text-primary, #e8eaf6);
}

.mh-rp-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Profile screen overlay ──────────────────────────────────────────────────── */

.mh-chat-stage {
  position: relative;
}

.mh-profile-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--mh-surface, #1a1e28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mh-profile-screen.mh-hidden {
  display: none !important;
}

.mh-ps-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--mh-border, rgba(255,255,255,0.07));
  flex-shrink: 0;
}

.mh-ps-back-btn,
.mh-ps-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--mh-text-secondary, rgba(232,234,246,0.6));
  cursor: pointer;
  font-size: 17px;
  transition: background 140ms, color 140ms;
  flex-shrink: 0;
}

.mh-ps-back-btn:hover,
.mh-ps-edit-btn:hover {
  background: var(--mh-surface-2, rgba(255,255,255,0.06));
  color: var(--mh-text-primary, #e8eaf6);
}

.mh-ps-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--mh-text-primary, #e8eaf6);
}

.mh-ps-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hero row */

.mh-ps-hero {
  background: var(--mh-surface-2, rgba(255,255,255,0.04));
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 4px;
}

.mh-ps-hero-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 18px;
  transition: background 140ms;
}

.mh-ps-hero-row:hover {
  background: var(--mh-surface-3, rgba(255,255,255,0.07));
}

.mh-ps-avatar {
  width: 52px !important;
  height: 52px !important;
  flex-shrink: 0;
  border-radius: 50% !important;
}

.mh-ps-hero-info {
  flex: 1;
  min-width: 0;
}

.mh-ps-hero-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--mh-text-primary, #e8eaf6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-ps-hero-phone,
.mh-ps-hero-username {
  font-size: 12px;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
  margin-top: 2px;
}

.mh-ps-hero-chevron {
  font-size: 16px;
  color: var(--mh-text-muted, rgba(232,234,246,0.35));
  flex-shrink: 0;
}

/* Settings list */

.mh-ps-settings {
  background: var(--mh-surface-2, rgba(255,255,255,0.04));
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mh-ps-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-top: 1px solid var(--mh-border, rgba(255,255,255,0.05));
  background: transparent;
  color: var(--mh-text-primary, #e8eaf6);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 140ms;
}

.mh-ps-item:first-child {
  border-top: 0;
}

.mh-ps-item:hover {
  background: var(--mh-surface-3, rgba(255,255,255,0.07));
}

.mh-ps-item.is-active {
  background: rgba(123, 182, 255, 0.1);
  color: var(--mh-accent, #7bb6ff);
}

.mh-ps-item.is-active .mh-ps-item-icon {
  background: rgba(123, 182, 255, 0.18);
  color: var(--mh-accent, #7bb6ff);
}

.mh-ps-hero-row.is-active {
  background: rgba(123, 182, 255, 0.06);
}

.mh-ps-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--mh-surface-3, rgba(255,255,255,0.07));
  flex-shrink: 0;
  font-size: 15px;
  color: var(--mh-accent, #7bb6ff);
}

.mh-ps-item-label {
  flex: 1;
}

.mh-ps-item-chevron {
  font-size: 14px;
  color: var(--mh-text-muted, rgba(232,234,246,0.35));
  flex-shrink: 0;
}

/* Appearance panel */

.mh-ps-appearance-panel {
  padding: 16px;
  background: var(--mh-surface-2, rgba(255,255,255,0.04));
  border-radius: 18px;
  margin-top: 4px;
}

.mh-ps-appearance-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mh-text-secondary, rgba(232,234,246,0.55));
  margin-bottom: 12px;
}

.mh-ps-theme-options {
  display: flex;
  gap: 10px;
}

.mh-ps-theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--mh-surface-3, rgba(255,255,255,0.06));
  color: var(--mh-text-secondary, rgba(232,234,246,0.7));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms, background 180ms;
}

.mh-ps-theme-btn:hover {
  background: var(--mh-surface-3, rgba(255,255,255,0.1));
}

.mh-ps-theme-btn.is-active {
  border-color: var(--mh-accent, #7bb6ff);
  color: var(--mh-text-primary, #e8eaf6);
}

.mh-ps-theme-swatch {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  display: block;
}

.mh-ps-theme-dark {
  background: linear-gradient(135deg, #0d1117 0%, #1a1e28 100%);
  border: 1px solid rgba(255,255,255,0.08);
}

.mh-ps-theme-light {
  background: linear-gradient(135deg, #f0f2f5 0%, #ffffff 100%);
  border: 1px solid rgba(0,0,0,0.1);
}

/* ── Call: active-call badge in chat header ───────────────────────────────── */

.mh-active-call-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.16);
  color: #22c55e;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.mh-active-call-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: mh-call-pulse 1.4s ease-in-out infinite;
}

@keyframes mh-call-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

/* ── Call: incoming call banner ──────────────────────────────────────────── */

.mh-incoming-call {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-width: 320px;
  max-width: calc(100vw - 40px);
  background: rgba(22, 26, 46, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: mh-incoming-slide-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mh-incoming-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)      scale(1); }
}

.mh-incoming-call-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  animation: mh-call-ring 0.7s ease-in-out infinite alternate;
}

@keyframes mh-call-ring {
  from { transform: rotate(-12deg); }
  to   { transform: rotate(12deg); }
}

.mh-incoming-call-info {
  flex: 1;
  min-width: 0;
}

.mh-incoming-call-name {
  font-size: 15px;
  font-weight: 600;
  color: rgba(232, 234, 246, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-incoming-call-type {
  font-size: 12px;
  color: rgba(232, 234, 246, 0.5);
  margin-top: 2px;
}

.mh-call-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.mh-call-action-btn:hover { opacity: 0.85; transform: scale(1.08); }
.mh-call-action-btn:active { transform: scale(0.95); }

.mh-call-action-btn.is-decline {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}

.mh-call-action-btn.is-accept {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
}

/* ── Call: full-screen overlay ───────────────────────────────────────────── */

.mh-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 60% 20%, rgba(99, 102, 241, 0.18) 0%, transparent 65%),
              radial-gradient(ellipse at 20% 80%, rgba(34, 197, 94, 0.1) 0%, transparent 60%),
              rgba(10, 12, 20, 0.97);
  backdrop-filter: blur(4px);
  transition: none;
}

/* ── PiP (picture-in-picture) mode ─────────────────────────────────────── */
.mh-call-overlay.is-pip {
  inset: auto;
  width: 320px;
  height: 240px;
  bottom: 24px;
  right: 24px;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
  overflow: hidden;
  resize: none;
}
.mh-call-overlay.is-pip .mh-call-overlay-header {
  cursor: grab;
  padding: 10px 12px 0;
  user-select: none;
}
.mh-call-overlay.is-pip .mh-call-overlay-header:active { cursor: grabbing; }
.mh-call-overlay.is-pip .mh-call-grid {
  padding: 8px;
  gap: 4px;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}
.mh-call-overlay.is-pip .mh-call-bar {
  padding: 6px 10px;
}
.mh-call-overlay.is-pip .mh-call-participant-count { display: none; }
.mh-call-overlay.is-pip .mh-call-toast { display: none; }
.mh-call-overlay.is-pip .mh-call-invite-modal { display: none; }

.mh-call-pip-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(232, 234, 246, 0.55);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 16px;
  padding: 0;
}
.mh-call-pip-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(232, 234, 246, 0.9);
}

.mh-call-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  gap: 12px;
}

.mh-call-overlay-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(232, 234, 246, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-call-timer {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: rgba(232, 234, 246, 0.5);
  flex-shrink: 0;
}

/* ── Call: participant grid ──────────────────────────────────────────────── */

.mh-call-grid {
  flex: 1;
  display: grid;
  gap: 8px;
  padding: 16px;
  overflow: hidden;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: minmax(160px, 1fr);
}

.mh-call-tile {
  position: relative;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.mh-call-tile.is-local {
  border-color: rgba(99, 102, 241, 0.4);
}

/* Pinned tile: expands to fill the first row, others shrink to thumbnail strip */
.mh-call-grid.has-pinned {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  grid-template-rows: 1fr auto;
}

.mh-call-tile.is-pinned {
  grid-column: 1 / -1;
  grid-row: 1;
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
  cursor: context-menu;
}

.mh-call-grid.has-pinned .mh-call-tile:not(.is-pinned) {
  grid-row: 2;
  min-height: 80px;
  max-height: 110px;
}

.mh-call-tile:not(.is-local) {
  cursor: context-menu;
}

.mh-call-tile-avatar {
  font-size: 48px;
  color: rgba(232, 234, 246, 0.3);
  margin-bottom: 8px;
}

.mh-call-tile-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(232, 234, 246, 0.6);
  position: absolute;
  bottom: 10px;
  left: 12px;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 8px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.mh-call-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.mh-call-video.is-screen {
  object-fit: contain;
  background: #000;
}

/* ── Call: toast notification ───────────────────────────────────────────── */

.mh-call-toast {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 68, 68, 0.88);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 20px;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.mh-call-toast.mh-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Call: control bar ───────────────────────────────────────────────────── */

.mh-call-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px 28px;
  position: relative;
}

.mh-call-participant-count {
  position: absolute;
  left: 24px;
  font-size: 12px;
  color: rgba(232, 234, 246, 0.4);
  pointer-events: none;
}

.mh-call-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mh-call-ctrl {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(232, 234, 246, 0.9);
}

.mh-call-ctrl:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.06);
}

.mh-call-ctrl:active { transform: scale(0.94); }

.mh-call-ctrl.is-off {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}

.mh-call-ctrl.is-denied {
  background: rgba(239, 68, 68, 0.12);
  color: rgba(239, 68, 68, 0.6);
  cursor: default;
}

.mh-call-ctrl.is-active {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.mh-call-ctrl.is-hangup {
  background: rgba(239, 68, 68, 0.22);
  color: #ef4444;
}

.mh-call-ctrl.is-hangup:hover {
  background: rgba(239, 68, 68, 0.4);
}

/* Call system messages */
.mh-msg-row--call {
  display: flex;
  justify-content: center;
  padding: 4px 16px;
}

.mh-call-msg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  max-width: 340px;
  cursor: default;
  user-select: none;
}

.mh-call-msg-icon {
  font-size: 15px;
  flex-shrink: 0;
  color: var(--mh-text-secondary, #9aa3b2);
}

.mh-call-msg--incoming .mh-call-msg-icon,
.mh-call-msg--outgoing .mh-call-msg-icon {
  color: #4ade80;
}

.mh-call-msg--failed .mh-call-msg-icon {
  color: #f87171;
}

.mh-call-msg-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--mh-text-primary, #e8eaf6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-call-msg--failed .mh-call-msg-text {
  color: #f87171;
}

.mh-call-msg-time {
  font-size: 11px;
  color: var(--mh-text-secondary, #9aa3b2);
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: 2px;
}

html[data-theme="light"] .mh-call-msg {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .mh-call-msg--incoming .mh-call-msg-icon,
html[data-theme="light"] .mh-call-msg--outgoing .mh-call-msg-icon {
  color: #16a34a;
}

html[data-theme="light"] .mh-call-msg--failed .mh-call-msg-icon,
html[data-theme="light"] .mh-call-msg--failed .mh-call-msg-text {
  color: #dc2626;
}

/* ── Call: invite modal ──────────────────────────────────────────────────── */

.mh-call-invite-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.mh-call-invite-box {
  background: #1a1d2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mh-call-invite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mh-call-invite-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(232, 234, 246, 0.9);
}

.mh-call-invite-close {
  background: none;
  border: none;
  color: rgba(232, 234, 246, 0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}
.mh-call-invite-close:hover { color: rgba(232, 234, 246, 0.8); }

.mh-call-invite-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mh-call-invite-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(232, 234, 246, 0.8);
}

.mh-call-invite-desc {
  font-size: 12px;
  color: rgba(232, 234, 246, 0.4);
}

.mh-call-invite-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
}

.mh-call-invite-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mh-call-invite-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(232, 234, 246, 0.7);
  font-size: 12px;
  padding: 7px 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-call-invite-copy {
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 8px;
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.mh-call-invite-copy:hover { background: rgba(99, 102, 241, 0.35); }
.mh-call-invite-copy--full { width: 100%; text-align: center; }

.mh-call-invite-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.mh-call-invite-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  width: 100%;
}
.mh-call-invite-contact:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.mh-call-invite-contact:disabled { opacity: 0.65; cursor: default; }

.mh-call-invite-contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mh-call-invite-contact-initials {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.mh-call-invite-contact-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.mh-call-invite-contact-name {
  flex: 1;
  font-size: 13px;
  color: rgba(232, 234, 246, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-call-invite-contact-action {
  font-size: 12px;
  color: #a5b4fc;
  flex-shrink: 0;
}

.mh-call-invite-empty {
  font-size: 13px;
  color: rgba(232, 234, 246, 0.3);
  padding: 8px 0;
  text-align: center;
}

/* ── Guest call join overlay ─────────────────────────────────────────────── */

.mh-guest-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 20%, rgba(99, 102, 241, 0.18) 0%, transparent 65%),
              rgba(10, 12, 20, 0.97);
  backdrop-filter: blur(4px);
}

.mh-guest-call-box {
  background: #1a1d2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.mh-guest-call-icon {
  font-size: 40px;
  color: #818cf8;
  margin-bottom: 4px;
}

.mh-guest-call-title {
  font-size: 18px;
  font-weight: 700;
  color: rgba(232, 234, 246, 0.95);
  margin: 0;
}

.mh-guest-call-desc {
  font-size: 13px;
  color: rgba(232, 234, 246, 0.5);
  margin: 0 0 4px;
}

.mh-guest-call-box .mh-input {
  width: 100%;
  text-align: center;
}

.mh-guest-call-box .mh-btn--primary {
  width: 100%;
  margin-top: 4px;
}

.mh-guest-call-error {
  font-size: 12px;
  color: #f87171;
  margin: 0;
}
