:root {
  --primary: #4f3f73;
  --primary-soft: color-mix(in srgb, var(--primary) 12%, #fff);
  --primary-mid: color-mix(in srgb, var(--primary) 28%, var(--surface));
  --accent: #c45c2a;
  --surface: #ffffff;
  --surface-2: #f7f6fa;
  --bg: #ebe8f2;
  --text: #1a1625;
  --text-muted: #6e687a;
  --border: #ddd8e6;
  --border-strong: #c9c2d4;
  --danger: #b42318;
  --success: #1f7a4c;
  --shadow-sm: 0 1px 2px rgba(26, 22, 37, 0.05);
  --shadow-md: 0 10px 30px rgba(26, 22, 37, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --sidebar-w: 340px;
  --info-w: 300px;
  --tablet-sidebar-w: min(300px, 36vw);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --primary-soft: color-mix(in srgb, var(--primary) 20%, #16121f);
  --primary-mid: color-mix(in srgb, var(--primary) 32%, #16121f);
  --surface: #1e1a28;
  --surface-2: #16121f;
  --bg: #0f0d14;
  --text: #f0edf5;
  --text-muted: #a39aad;
  --border: #2e2838;
  --border-strong: #3d3548;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] body {
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--primary) 32%, transparent), transparent 58%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 52%),
    linear-gradient(180deg, #14101c 0%, var(--bg) 100%);
}

[data-theme="dark"] .ms-login__card,
[data-theme="dark"] .ms-search,
[data-theme="dark"] .ms-cohort-filter,
[data-theme="dark"] .ms-inbox-filter__btn,
[data-theme="dark"] .ms-inbox-filter__menu,
[data-theme="dark"] .ms-ghost-btn,
[data-theme="dark"] .ms-thread-header__back,
[data-theme="dark"] .ms-topbar-btn,
[data-theme="dark"] .ms-chip-btn,
[data-theme="dark"] .ms-action-sheet__card,
[data-theme="dark"] .ms-modal__card,
[data-theme="dark"] .ms-info-drawer__card,
[data-theme="dark"] .ms-info-drawer__head {
  background: var(--surface);
  color: var(--text);
}
[data-theme="dark"] .ms-profile-menu,
[data-theme="dark"] .ms-profile-menu__head {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .ms-profile__trigger {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .form-control {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .form-select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .ms-search:focus-within,
[data-theme="dark"] .ms-role-toggle label {
  background: var(--surface-2);
}

[data-theme="dark"] .ms-msg-row.is-in .ms-msg-bubble {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .ms-messages {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--primary) 12%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 35%, #000), color-mix(in srgb, var(--bg) 65%, #000));
}

[data-theme="dark"] .ms-toast--message {
  background: color-mix(in srgb, var(--primary) 75%, #111);
}

[data-theme="dark"] .alert-danger {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: #ffb4ab;
}

/* Dark-mode surfaces that previously mixed against white */
[data-theme="dark"] .ms-inbox-item:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}
[data-theme="dark"] .ms-inbox-item.is-active {
  background: color-mix(in srgb, var(--primary) 22%, var(--surface));
  box-shadow: inset 3px 0 0 var(--primary);
}
[data-theme="dark"] .ms-inbox-item:active {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
}
[data-theme="dark"] .ms-pinned-bar {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
[data-theme="dark"] .ms-composer,
[data-theme="dark"] .ms-thread-header,
[data-theme="dark"] .ms-sidebar__head,
[data-theme="dark"] .ms-sidebar__toolbar,
[data-theme="dark"] .ms-sidebar__foot {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .ms-composer__input,
[data-theme="dark"] .ms-composer__tool,
[data-theme="dark"] .ms-composer__attach-menu,
[data-theme="dark"] .ms-composer__mentions,
[data-theme="dark"] .ms-composer__preview-card,
[data-theme="dark"] .ms-search:focus-within,
[data-theme="dark"] .ms-msg-reaction,
[data-theme="dark"] .ms-msg-action,
[data-theme="dark"] .ms-ghost-btn,
[data-theme="dark"] .ms-topbar-btn,
[data-theme="dark"] .ms-chip-btn,
[data-theme="dark"] .ms-icon-btn--ghost,
[data-theme="dark"] .ms-thread-search,
[data-theme="dark"] .ms-thread-search input,
[data-theme="dark"] .ms-info-notif-prefs__btn,
[data-theme="dark"] .ms-forward-list__item:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .ms-composer__input::placeholder,
[data-theme="dark"] .ms-thread-search input::placeholder {
  color: var(--text-muted);
}
[data-theme="dark"] .ms-composer__recording {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
[data-theme="dark"] .ms-composer__failed,
[data-theme="dark"] .ms-composer__blocked {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--text);
}
[data-theme="dark"] .ms-typing {
  color: var(--text-muted);
  background: transparent;
}
[data-theme="dark"] .ms-msg-row.is-out .ms-msg-row__menu {
  background: color-mix(in srgb, var(--primary) 34%, var(--surface));
  color: var(--text);
}
[data-theme="dark"] .ms-role-badge,
[data-theme="dark"] .ms-inbox-item__tag {
  background: color-mix(in srgb, var(--primary) 22%, var(--surface));
  color: color-mix(in srgb, var(--primary) 55%, var(--text));
  border-color: var(--border);
}
[data-theme="dark"] .ms-info-note,
[data-theme="dark"] .ms-notif-prompt,
[data-theme="dark"] .ms-offline-banner {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .ms-modal__backdrop,
[data-theme="dark"] .ms-info-drawer__backdrop,
[data-theme="dark"] .ms-action-sheet__backdrop {
  background: rgba(0, 0, 0, 0.72);
}
[data-theme="dark"] .ms-voice-player,
[data-theme="dark"] .ms-file-chip,
[data-theme="dark"] .ms-msg-reply,
[data-theme="dark"] .ms-jump-unread {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .ms-msg-row.is-out .ms-voice-player,
[data-theme="dark"] .ms-msg-row.is-out .ms-file-chip {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}
[data-theme="dark"] .ms-presence-dot {
  border-color: var(--surface);
}
[data-theme="dark"] .ms-empty-state__mark {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--primary) 28%, var(--surface)),
    color-mix(in srgb, var(--accent) 18%, var(--surface))
  );
  color: color-mix(in srgb, var(--primary) 40%, var(--text));
}
[data-theme="dark"] .ms-info-notif-prefs__btn.is-active,
[data-theme="dark"] .ms-action-sheet__btn.is-active {
  background: color-mix(in srgb, var(--primary) 26%, var(--surface));
  color: color-mix(in srgb, var(--primary) 45%, var(--text));
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 58%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, #fff) 0%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

#msApp {
  height: 100%;
  min-height: 100dvh;
  position: relative;
}

/* Launch splash — visible before JS boot completes */
.ms-boot {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 58%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, #fff) 0%, var(--bg) 100%);
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
}
[data-theme="dark"] .ms-boot {
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--primary) 32%, transparent), transparent 58%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 52%),
    linear-gradient(180deg, #14101c 0%, var(--bg) 100%);
}
.ms-boot.is-hiding {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
}
.ms-boot__card {
  width: min(100%, 320px);
  text-align: center;
  padding: 1.75rem 1.35rem 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}
.ms-boot__logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}
.ms-boot__title {
  margin: 0.85rem 0 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.ms-boot__spinner {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
}
.ms-boot__hint {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Full-screen offline (cold start / no cached shell) */
body.ms-offline-mode {
  overflow: hidden;
}
.ms-offline-screen {
  position: absolute;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 58%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, #fff) 0%, var(--bg) 100%);
}
[data-theme="dark"] .ms-offline-screen {
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--primary) 32%, transparent), transparent 58%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 52%),
    linear-gradient(180deg, #14101c 0%, var(--bg) 100%);
}
.ms-offline-screen.is-static {
  position: relative;
  min-height: 100dvh;
}
.ms-offline-screen.d-none { display: none !important; }
.ms-offline-screen__inner {
  width: min(100%, 360px);
  text-align: center;
  padding: 1.75rem 1.35rem 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}
.ms-offline-screen__logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}
.ms-offline-screen__title {
  margin: 0.85rem 0 0.35rem;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.ms-offline-screen__message {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
  font-size: 0.92rem;
}
.ms-offline-screen__app {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--primary) 70%, var(--text-muted));
}
.ms-offline-screen__retry {
  margin-top: 1.1rem;
  min-width: 9rem;
  border-radius: 999px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, #fff);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transition: background 160ms var(--ease), transform 160ms var(--ease);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--primary) 86%, #000);
  border-color: transparent;
}
.btn-primary:active { transform: translateY(1px); }

/* ——— Login ——— */
.ms-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.ms-login::before {
  content: "";
  position: absolute;
  inset: -20% auto auto -10%;
  width: min(70vw, 520px);
  height: min(70vw, 520px);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 28%, transparent), transparent 70%);
  animation: ms-float 12s ease-in-out infinite;
  pointer-events: none;
}
.ms-login::after {
  content: "";
  position: absolute;
  inset: auto -15% -25% auto;
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  animation: ms-float 14s ease-in-out infinite reverse;
  pointer-events: none;
}
.ms-login__card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid color-mix(in srgb, var(--border) 80%, #fff);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: var(--shadow-md);
  animation: ms-rise 420ms var(--ease) both;
}
.ms-login__brand {
  font-family: var(--display);
  font-size: clamp(1.65rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  color: var(--primary);
}
.ms-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.65rem;
}
.ms-brand__name {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
  line-height: 1.15;
}
.ms-brand--login .ms-brand__name {
  font-size: clamp(1.45rem, 3.6vw, 1.85rem);
}
.ms-brand--sidebar {
  display: none;
  margin: 0 0 0.85rem;
}
.ms-brand--sidebar .ms-brand__name {
  font-size: 1.05rem;
}
.ms-brand--topbar {
  margin: 0;
  min-width: 0;
}
.ms-brand--topbar .ms-brand__name {
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-brand-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}
.ms-brand-logo--login,
.ms-brand--login .ms-brand-logo {
  width: 52px;
  height: 52px;
}
.ms-brand-logo--sm,
.ms-brand--sidebar .ms-brand-logo {
  width: 36px;
  height: 36px;
}
.ms-brand-logo--xs,
.ms-brand--topbar .ms-brand-logo {
  width: 28px;
  height: 28px;
}
.ms-brand-logo--empty {
  width: 2.4rem;
  height: 2.4rem;
}
.ms-empty-state__mark .ms-brand-logo {
  width: 2.4rem;
  height: 2.4rem;
}
@media (min-width: 768px) {
  .ms-brand--sidebar { display: flex; }
  .ms-sidebar__brand { display: block; }
  .ms-sidebar__brand.ms-brand { display: flex; }
}
.ms-login__sub {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.45;
}
.ms-login__social {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  margin: 0.15rem 0 1rem;
}
.ms-login__faces {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.15rem 0.35rem 0;
}
.ms-login__face {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--surface);
  background: var(--surface-2);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ink, #1a1a1a) 12%, transparent);
  margin-left: -14px;
}
.ms-login__face:first-child {
  margin-left: 0;
}
.ms-login__face--hero {
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-width: 3px;
  position: relative;
}
.ms-login__social-copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
}
.ms-role-toggle--2 {
  grid-template-columns: 1fr 1fr;
}
.ms-login .form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.ms-login .form-control,
.ms-login .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  padding: 0.65rem 0.85rem;
  background: var(--surface);
}
.ms-login .form-control:focus,
.ms-login .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.ms-login__submit {
  margin-top: 0.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  padding: 0.7rem 1rem;
}
.ms-role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.ms-role-toggle--3 {
  grid-template-columns: repeat(3, 1fr);
}
.ms-role-toggle--3 label {
  font-size: 0.82rem;
  min-height: 2.5rem;
  padding: 0 0.35rem;
  text-align: center;
}
.ms-role-toggle--4 {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 420px) {
  .ms-role-toggle--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}
.ms-role-toggle--4 label {
  font-size: 0.78rem;
  min-height: 2.5rem;
  padding: 0 0.3rem;
  text-align: center;
}
.ms-role-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ms-role-toggle label {
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}
.ms-role-toggle input:checked + label {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.ms-role-toggle input:focus-visible + label {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, #fff);
  outline-offset: 2px;
}

/* ——— Shell ——— */
.ms-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: ms-fade 280ms var(--ease) both;
}
.ms-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ms-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.ms-topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.ms-topbar-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}
.ms-topbar-btn--primary {
  width: 2.5rem;
  padding: 0;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.ms-topbar-btn--primary:hover {
  background: color-mix(in srgb, var(--primary) 88%, #000);
  color: #fff;
}
.ms-topbar-btn--primary svg {
  width: 1.05rem;
  height: 1.05rem;
}
.ms-topbar-btn--icon {
  width: 2.5rem;
  padding: 0;
}
.ms-topbar-btn--icon svg {
  width: 1.05rem;
  height: 1.05rem;
}
@media (min-width: 768px) {
  .ms-topbar { display: none; }
}
.ms-topbar__brand {
  min-width: 0;
  flex: 1;
}
.ms-topbar strong {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--primary);
}
.ms-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-top: 1px solid transparent;
}
@media (min-width: 768px) {
  .ms-grid {
    grid-template-columns: var(--tablet-sidebar-w) minmax(0, 1fr);
  }
}
@media (min-width: 1200px) {
  .ms-grid { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--info-w); }
}
.ms-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.ms-col--sidebar {
  border-right: 1px solid var(--border);
  min-width: 0;
}
.ms-col--info {
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0;
  min-height: 0;
  overflow: hidden;
}
.ms-info-empty,
.ms-info-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.1rem 1rem;
}
.ms-col--thread {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 6%, var(--surface)) 0%, transparent 120px),
    var(--surface-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.ms-sidebar__head {
  padding: 1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ms-sidebar__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0;
}
.ms-sidebar__head-row .ms-sidebar__brand {
  margin-bottom: 0;
  min-width: 0;
  flex: 1;
}
.ms-sidebar__head-actions {
  flex-shrink: 0;
}
.ms-sidebar__brand {
  display: none;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
@media (min-width: 768px) {
  .ms-sidebar__brand { display: block; }
  .ms-sidebar__brand.ms-brand { display: flex; }
}
.ms-sidebar__toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.ms-sidebar__search-zone {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ms-search-hint {
  margin: 0;
  padding: 0 0.15rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
}
.ms-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ms-search-clear svg {
  width: 0.95rem;
  height: 0.95rem;
}
.ms-search-clear:hover {
  background: var(--surface-2);
  color: var(--text);
}
.ms-search-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.ms-search-scopes.is-loading {
  opacity: 0.72;
}
.ms-search-scopes__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
}
.ms-search-scopes__btn.is-active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}
.ms-inbox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 0 0.15rem;
}
.ms-inbox-chips:empty {
  display: none;
}
.ms-inbox-chips__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.ms-inbox-chips__btn.is-active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}
.ms-inbox-filter-wrap {
  position: relative;
}
.ms-inbox-filter__btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.84rem;
  text-align: left;
}
.ms-inbox-filter__btn.is-active {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-2));
}
.ms-inbox-filter__btn.is-loading {
  opacity: 0.72;
  pointer-events: none;
}
.ms-inbox-filter__btn.is-loading .ms-inbox-filter__chev {
  animation: ms-spin 0.8s linear infinite;
}
.ms-inbox-filter__icon,
.ms-inbox-filter__chev {
  display: inline-flex;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ms-inbox-filter__icon svg,
.ms-inbox-filter__chev svg {
  width: 1rem;
  height: 1rem;
}
.ms-inbox-filter__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-inbox-filter__native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.ms-inbox-filter__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: min(18rem, 42vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
  padding: 0.35rem;
}
.ms-inbox-filter__group {
  padding: 0.45rem 0.55rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ms-inbox-filter__option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
}
.ms-inbox-filter__option--nested {
  padding-left: 1.15rem;
}
.ms-inbox-filter__option:hover {
  background: var(--primary-soft);
}
.ms-inbox-filter__option.is-active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  font-weight: 600;
}
.ms-inbox-list-heading {
  padding: 0.55rem 0.85rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ms-search-hits__empty {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ms-sidebar__toolbar .ms-search {
  flex: 1;
  min-width: 0;
}
.ms-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  transition: border-color 160ms var(--ease), background 160ms var(--ease), box-shadow 160ms var(--ease);
}
.ms-search:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.ms-search__icon {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.ms-search__icon svg {
  width: 100%;
  height: 100%;
}
.ms-search input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.45rem 0;
  min-width: 0;
  color: var(--text);
}
.ms-search input:focus { outline: none; }
.ms-search input::placeholder { color: var(--text-muted); }
.ms-cohort-filter {
  width: 100%;
  min-height: 2.2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
}
.ms-cohort-filter:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.ms-inbox-item__course {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.05rem 0 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-thread-error {
  padding: 1.25rem 1rem;
  color: var(--text-muted);
  text-align: center;
}
.ms-info-course {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}
.ms-icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}
.ms-icon-btn:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.ms-icon-btn:active { transform: scale(0.96); }
.ms-icon-btn svg { width: 1.05rem; height: 1.05rem; }

.ms-sidebar__list {
  flex: 0 0 auto;
}
.ms-inbox-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  position: relative;
  transition: transform 180ms var(--ease);
}
.ms-pull-refresh {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  height: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  transition: height 120ms var(--ease);
}
.ms-pull-refresh__spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  border-top-color: var(--primary);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
}
.ms-pull-refresh.is-ready .ms-pull-refresh__spinner {
  opacity: 1;
  transform: scale(1);
}
.ms-pull-refresh.is-loading .ms-pull-refresh__spinner {
  opacity: 1;
  animation: ms-spin 0.7s linear infinite;
}
.ms-pull-refresh.is-ready {
  color: var(--primary);
}
.ms-pull-refresh.is-loading {
  color: var(--text-muted);
}
.ms-user-chip__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  justify-content: flex-end;
}
.ms-sidebar__foot {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.ms-user-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.ms-user-chip__name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-user-chip .btn-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}
.ms-user-chip .btn-link:hover { color: var(--primary); }

/* New chat */
.ms-newchat-panel {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  animation: ms-rise 240ms var(--ease) both;
}
.ms-newchat { padding: 0.85rem 1rem 1rem; }
.ms-newchat .ms-search {
  width: 100%;
  flex: none;
  align-self: stretch;
}
.ms-newchat__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}
.ms-newchat__head strong {
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.ms-newchat__list {
  max-height: 15rem;
  overflow-y: auto;
  margin-top: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.ms-newchat__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.ms-newchat__item:last-child { border-bottom: 0; }
.ms-newchat__item:hover { background: var(--primary-soft); }
.ms-newchat__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-mid);
  flex-shrink: 0;
}

/* Inbox items */
.ms-inbox-item {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  transition: background 140ms var(--ease);
}
.ms-inbox-item:hover { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.ms-inbox-item.is-active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
.ms-inbox-item:active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}
.ms-inbox-item.is-unread .ms-inbox-item__title { font-weight: 700; }
.ms-inbox-item.is-unread .ms-inbox-item__preview { color: var(--text); font-weight: 500; }
.ms-inbox-item__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-mid);
  flex-shrink: 0;
}
.ms-inbox-item__avatar--type {
  display: grid;
  place-items: center;
  color: #fff;
}
.ms-inbox-item__avatar--type svg {
  width: 1.35rem;
  height: 1.35rem;
}
.ms-inbox-item__avatar--course {
  background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 65%, #000));
}
.ms-inbox-item__avatar--subgroup {
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
}
.ms-inbox-item__avatar-wrap,
.ms-avatar-wrap {
  position: relative;
  display: inline-grid;
  flex-shrink: 0;
}
.ms-avatar-wrap--sm .ms-newchat__avatar,
.ms-avatar-wrap--sm img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.ms-presence-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c5c0bc;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.ms-presence-dot.is-online {
  background: #22a06b;
  opacity: 1;
}
.ms-presence-dot--inbox {
  width: 12px;
  height: 12px;
}
.ms-thread-header__sub.is-online {
  color: #1f7a54;
  font-weight: 600;
}
.ms-presence-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}
.ms-presence-label.is-online {
  color: #1f7a54;
}
.ms-newchat__meta {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}
.ms-newchat__meta > span,
.ms-newchat__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.ms-newchat__common {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-info-member__meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}
.ms-info-member__meta > span:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0;
  line-height: 1.35;
}
.ms-inbox-item__body { min-width: 0; flex: 1; }
.ms-inbox-item__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.ms-inbox-item__row + .ms-inbox-item__row { margin-top: 0.2rem; }
.ms-inbox-item__title {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-inbox-item__time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ms-inbox-item.is-unread .ms-inbox-item__time { color: var(--primary); font-weight: 600; }
.ms-inbox-item__preview {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ms-inbox-item__badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ms-inbox-empty,
.ms-inbox-error {
  padding: 1.5rem 1.1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.ms-inbox-error { color: var(--danger); }

/* Empty / thread host */
.ms-empty-state {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  animation: ms-fade 360ms var(--ease) both;
}
.ms-empty-state__mark {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.25rem;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--primary) 22%, var(--surface)), color-mix(in srgb, var(--accent) 16%, var(--surface)));
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.ms-empty-state__mark svg {
  width: 2rem;
  height: 2rem;
}
.ms-empty-state__mark:has(.ms-brand-logo) {
  background: var(--surface);
  border: 1px solid var(--border);
}
.ms-empty-state h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--text);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
.ms-empty-state p {
  margin: 0;
  max-width: 22rem;
  line-height: 1.5;
}
.ms-thread-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: ms-fade 220ms var(--ease) both;
}

/* Thread */
.ms-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.ms-thread-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
}
.ms-thread-header__back {
  width: 2.1rem;
  height: 2.1rem;
  display: none;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  flex-shrink: 0;
  transition: background 140ms var(--ease);
}
.ms-thread-header__back:hover { background: var(--surface-2); }
.ms-thread-header__back svg { width: 1rem; height: 1rem; }
.ms-thread-header__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-mid);
  flex-shrink: 0;
  cursor: pointer;
}
.ms-thread-header__avatar--type {
  display: grid;
  place-items: center;
  color: #fff;
  border: 0;
  padding: 0;
}
.ms-thread-header__avatar--type svg {
  width: 1.15rem;
  height: 1.15rem;
}
.ms-thread-header__avatar--course {
  background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 65%, #000));
}
.ms-thread-header__avatar--subgroup {
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
}
.ms-thread-header__avatar--direct,
.ms-thread-header__avatar--group {
  background: linear-gradient(145deg, var(--primary-mid), var(--primary));
}
.ms-thread-header__meta { min-width: 0; flex: 1; }
.ms-thread-header__title {
  font-size: 1rem;
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-thread-header__sub {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-thread-header__sub.is-online {
  color: #1f7a54;
  font-weight: 600;
}
.ms-thread-header__course {
  margin: 0.08rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-thread-header__actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.ms-ghost-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 0;
}
.ms-ghost-btn:hover { color: var(--text); background: var(--surface-2); }
.ms-ghost-btn svg { width: 1rem; height: 1rem; }
.ms-thread-search {
  display: none;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
.ms-thread-search.is-open { display: block; animation: ms-rise 180ms var(--ease) both; }

.ms-messages {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--primary) 8%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, var(--surface)), color-mix(in srgb, var(--bg) 70%, var(--surface)));
}
.ms-load-older {
  align-self: center;
  margin-bottom: 0.35rem;
  border-radius: 999px;
  font-size: 0.8rem;
}
.ms-msg-row {
  max-width: min(92%, 34rem);
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.45rem;
  width: fit-content;
  position: relative;
  touch-action: pan-y;
  animation: ms-msg-in 220ms var(--ease) both;
}
.ms-msg-swipe-reply {
  position: absolute;
  left: 0.2rem;
  top: 50%;
  width: 1.85rem;
  height: 1.85rem;
  margin-top: -0.925rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
  opacity: 0;
  transform: scale(0.55);
  pointer-events: none;
  z-index: 0;
}
.ms-msg-row.has-avatar .ms-msg-swipe-reply {
  left: 2.65rem;
}
.ms-msg-row.is-out .ms-msg-swipe-reply,
.ms-msg-row.is-out.has-avatar .ms-msg-swipe-reply {
  left: 0.2rem;
}
.ms-msg-swipe-reply svg {
  width: 1rem;
  height: 1rem;
}
.ms-msg-row.is-swipe-armed .ms-msg-swipe-reply {
  background: var(--primary);
  color: #fff;
}
.ms-msg-row.is-swipe-reply .ms-msg-row__content {
  will-change: transform;
  position: relative;
  z-index: 1;
}
.ms-msg-row.is-out {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ms-msg-row.is-in { align-self: flex-start; }
.ms-msg-row__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-mid);
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 1.15rem;
}
.ms-msg-row__avatar-btn {
  display: inline-grid;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 1.15rem;
  border-radius: 50%;
}
.ms-msg-row__avatar-btn .ms-msg-row__avatar {
  margin-bottom: 0;
  align-self: auto;
}
.ms-msg-row__avatar-btn:hover .ms-msg-row__avatar {
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.ms-msg-row__avatar--spacer {
  visibility: hidden;
  background: transparent;
}
.ms-msg-row__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 100%;
}
.ms-msg-row.is-out .ms-msg-row__content {
  align-items: flex-end;
}
.ms-msg-row.is-in .ms-msg-row__content {
  align-items: flex-start;
}
.ms-msg-row__line {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  position: relative;
}
.ms-msg-row.is-out .ms-msg-row__line {
  flex-direction: row-reverse;
}
.ms-msg-meta__name {
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.35rem;
}
button.ms-msg-meta__name--btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--text-muted);
}
button.ms-msg-meta__name--btn:hover {
  color: var(--primary);
  text-decoration: underline;
}
.ms-msg-bubble {
  position: relative;
  padding: 0.35rem 0.7rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  word-break: break-word;
  font-size: 0.875rem;
  line-height: 1.35;
  box-shadow: var(--shadow-sm);
  width: fit-content;
  max-width: min(100%, 22rem);
  flex: 0 1 auto;
}
.ms-msg-row.is-in .ms-msg-bubble {
  /* Incoming: soft tail on bottom-left */
  border-radius: 14px 14px 14px 4px;
}
.ms-msg-row.is-out .ms-msg-bubble {
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 88%, #2a2140), var(--primary));
  color: #fff;
  border-color: transparent;
  /* Outgoing: soft tail on bottom-right */
  border-radius: 14px 14px 4px 14px;
}
.ms-msg-body {
  display: block;
  white-space: normal;
  word-break: break-word;
}
.ms-msg-body strong {
  font-weight: 700;
}
.ms-msg-body em {
  font-style: italic;
}
.ms-msg-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.45rem;
  padding: 0 0.2rem;
}
.ms-msg-actions {
  display: none !important;
}
.ms-msg-bubble { position: relative; }
.ms-msg-row__menu {
  display: grid;
  flex-shrink: 0;
  align-self: center;
  border: 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text-muted);
  border-radius: 999px;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  place-items: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms var(--ease), background 120ms var(--ease), color 120ms var(--ease);
}
.ms-msg-row:hover .ms-msg-row__menu,
.ms-msg-row:focus-within .ms-msg-row__menu,
.ms-msg-row__menu:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.ms-msg-row.is-out .ms-msg-row__menu {
  background: color-mix(in srgb, var(--primary) 22%, var(--surface));
  color: color-mix(in srgb, var(--primary) 70%, #fff);
}
.ms-msg-row__menu:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.ms-msg-action {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 1.65rem;
  height: 1.65rem;
  box-shadow: none;
  cursor: pointer;
  font-size: 0.7rem;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  flex: 0 0 auto;
}
.ms-msg-action:hover { background: var(--surface-2); }
.ms-msg-reply {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  border: 0;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-left: 3px solid var(--primary);
  padding: 0.35rem 0.5rem;
  margin: 0 0 0.45rem;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-radius: 0 8px 8px 0;
  max-width: 100%;
}
.ms-msg-reply__thumb {
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  border-radius: 0.3rem;
  flex-shrink: 0;
  position: relative;
  display: block;
  background: color-mix(in srgb, var(--surface) 88%, var(--border));
}
.ms-msg-reply__icon {
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--primary);
}
.ms-msg-reply__icon svg {
  width: 0.95rem;
  height: 0.95rem;
}
.ms-msg-reply__body {
  min-width: 0;
  display: grid;
  gap: 0.05rem;
}
.ms-msg-reply__body strong {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
}
.ms-msg-reply__body span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-msg-row.is-out .ms-msg-reply {
  border-left-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
}
.ms-msg-row.is-out .ms-msg-reply__body strong,
.ms-msg-row.is-out .ms-msg-reply__icon {
  color: rgba(255, 255, 255, 0.95);
}
.ms-msg-forwarded {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-style: italic;
  opacity: 0.78;
  margin: 0 0 0.35rem;
}
.ms-msg-forwarded svg {
  width: 0.85rem;
  height: 0.85rem;
}
.ms-msg-reactions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0 0.15rem;
}
.ms-msg-reaction {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.ms-msg-reaction:hover { background: var(--surface-2); }
.ms-msg-reaction.is-mine {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.ms-typing {
  min-height: 1.35rem;
  padding: 0.15rem 1.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ms-typing__dots {
  display: inline-flex;
  gap: 0.18rem;
}
.ms-typing__dots span {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ms-bounce 1s infinite ease-in-out;
}
.ms-typing__dots span:nth-child(2) { animation-delay: 0.15s; }
.ms-typing__dots span:nth-child(3) { animation-delay: 0.3s; }

/* Composer */
.ms-composer {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem 0.9rem;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .ms-composer {
    padding-left: max(1rem, calc((100% - 52rem) / 2 + 1rem));
    padding-right: max(1rem, calc((100% - 52rem) / 2 + 1rem));
  }
}
.ms-composer__reply {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
}
.ms-composer__reply-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}
.ms-composer__reply-thumb {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: cover;
  border-radius: 0.4rem;
  flex-shrink: 0;
  position: relative;
  display: block;
  background: color-mix(in srgb, var(--surface) 88%, var(--border));
}
.ms-composer__reply-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--primary);
}
.ms-composer__reply-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}
.ms-composer__reply-text {
  min-width: 0;
  display: grid;
  gap: 0.05rem;
}
.ms-composer__reply-text strong {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}
.ms-composer__reply-text span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-composer__reply-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
}
.ms-composer__preview {
  margin-bottom: 0.55rem;
}
.ms-composer__preview-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  position: relative;
}
.ms-composer__preview-card--image {
  padding: 0;
  overflow: hidden;
  display: block;
}
.ms-composer__preview-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #ddd;
}
.ms-composer__preview-card--image img {
  width: 100%;
  max-height: 220px;
  height: auto;
  border-radius: 0;
  display: block;
}
.ms-composer__preview-clear {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.ms-composer__preview-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}
.ms-composer__preview-meta strong {
  font-size: 0.85rem;
}
.ms-composer__preview-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-composer__voice-badge,
.ms-composer__file-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}
.ms-composer__voice-badge svg,
.ms-composer__file-badge svg {
  width: 1.05rem;
  height: 1.05rem;
}
.ms-composer__recording {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0;
  padding: 0.35rem 0.25rem 0.35rem 0.15rem;
  border-radius: 999px;
  background: transparent;
  border: 0;
  font-size: 0.9rem;
  min-height: 2.75rem;
}
.ms-composer__recording.is-cancel {
  color: var(--danger);
}
.ms-composer__rec-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--danger);
  animation: ms-bounce 1s infinite ease-in-out;
  flex-shrink: 0;
}
.ms-composer__rec-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 2.4rem;
}
.ms-composer__rec-hint {
  flex: 1;
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-composer__recording.is-cancel .ms-composer__rec-hint {
  color: var(--danger);
}
.ms-composer__rec-cancel,
.ms-composer__rec-send {
  width: 2.55rem;
  height: 2.55rem;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
}
.ms-composer__rec-cancel {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--danger);
}
.ms-composer__rec-send {
  background: var(--primary);
  color: #fff;
}
.ms-composer__rec-cancel svg,
.ms-composer__rec-send svg {
  width: 1.1rem;
  height: 1.1rem;
}
.ms-composer__tool--voice {
  touch-action: none;
  user-select: none;
}
.ms-composer__row {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
  position: relative;
}
.ms-composer__editor {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}
.ms-composer__format {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0 0.15rem;
}
.ms-composer__format-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface-2);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.ms-composer__format-btn svg {
  width: 0.95rem;
  height: 0.95rem;
}
.ms-composer__format-btn:hover,
.ms-composer__format-btn:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  outline: none;
}
.ms-composer__format-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ms-composer__format-btn.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-2));
}
.ms-composer__input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.ms-composer__mirror {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 1.35rem;
  padding: 0.65rem 0.95rem;
  border: 1px solid transparent;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  background: transparent;
}
.ms-composer__mirror .ms-wa-mark {
  color: color-mix(in srgb, var(--text-muted) 72%, transparent);
  font-weight: 400;
  font-style: normal;
}
.ms-composer__mirror strong {
  font-weight: 700;
}
.ms-composer__mirror em {
  font-style: italic;
}
.ms-composer__mirror s {
  text-decoration: line-through;
}
.ms-composer__mirror .ms-msg-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  padding: 0.05em 0.3em;
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}
.ms-composer__input-wrap .ms-composer__input {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--surface);
  color: transparent;
  caret-color: var(--text);
  -webkit-text-fill-color: transparent;
}
.ms-composer__input-wrap:not(.has-text) .ms-composer__input {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}
.ms-composer__input-wrap .ms-composer__input::placeholder {
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  opacity: 1;
}
.ms-composer__input-wrap.has-text .ms-composer__input {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.ms-composer__input-wrap.has-text .ms-composer__mirror {
  border-color: var(--border);
  background: var(--surface);
}
.ms-composer__input-wrap.has-text:focus-within .ms-composer__mirror {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.ms-composer__input-wrap.has-text .ms-composer__input:focus {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.ms-msg-body s {
  text-decoration: line-through;
}
.ms-msg-body .ms-msg-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  padding: 0.05em 0.3em;
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}
.ms-composer__attach {
  position: relative;
  flex-shrink: 0;
}
.ms-composer__attach-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.45rem);
  min-width: 10.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 12;
  animation: ms-rise 160ms var(--ease) both;
}
.ms-composer__attach-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
}
.ms-composer__attach-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.ms-composer__attach-item svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}
.ms-composer__tool {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.ms-composer__tool--attach {
  background: var(--surface-2);
}
.ms-composer__tool--voice.d-none {
  display: none !important;
}
.ms-composer__tool:hover,
.ms-composer__tool.is-active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ms-composer__tool svg { width: 1.1rem; height: 1.1rem; }
.ms-composer__input {
  flex: 1;
  resize: none;
  width: 100%;
  min-height: 2.75rem;
  max-height: 160px;
  border-radius: 1.35rem;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--border);
  font: inherit;
  background: var(--surface);
  line-height: 1.4;
  min-width: 0;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.ms-composer__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.ms-composer__send {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 55%, var(--border));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 160ms var(--ease), background 160ms var(--ease), opacity 160ms var(--ease);
}
.ms-composer__send.is-ready {
  background: var(--primary);
}
.ms-composer__send:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.ms-composer__send:disabled { opacity: 0.45; cursor: not-allowed; }
.ms-composer__send:active:not(:disabled) { transform: scale(0.96); }
.ms-composer__send svg { width: 1.1rem; height: 1.1rem; }

/* Message media */
.ms-msg-bubble.has-media-only { padding: 0.25rem; }
.ms-msg-bubble.has-image { overflow: hidden; }
.ms-msg-bubble.has-media-only.has-image { padding: 0.2rem; }
.ms-msg-image {
  display: block;
  border: 0;
  padding: 0;
  margin: 0 0 0.35rem;
  background: transparent;
  cursor: zoom-in;
  border-radius: 12px;
  overflow: hidden;
  max-width: min(320px, 78vw);
}
.ms-msg-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  position: relative;
}
.ms-msg-row.is-out .ms-msg-image { max-width: min(320px, 78vw); }
.ms-msg-action svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

/* Info pane */
.ms-info-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 0.5rem 0.15rem;
}
.ms-info-panel h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}
.ms-info-panel .ms-info-type {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}
.ms-info-panel h4,
.ms-info-section,
.ms-info-drawer__section {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.55rem;
  font-weight: 700;
}
.ms-info-member {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0;
}
.ms-info-member__identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.15rem 0.25rem 0.15rem 0;
  margin: 0;
  text-align: left;
  color: inherit;
  border-radius: 0.55rem;
  cursor: default;
}
button.ms-info-member__identity {
  cursor: pointer;
}
button.ms-info-member__identity:hover {
  background: var(--primary-soft);
}
button.ms-info-member__identity:hover .ms-info-member__meta > span:first-child {
  color: var(--primary);
}
.ms-info-member__actions {
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
}
.ms-info-member__action {
  white-space: nowrap;
  font-size: 0.78rem;
}
@media (min-width: 1200px) {
  .ms-info-members {
    max-height: min(42vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.15rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
  }
}
@media (max-width: 767.98px) {
  .ms-info-member {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }
  .ms-info-member__actions {
    flex: 1 1 100%;
    margin-left: calc(36px + 0.65rem);
    text-align: left;
  }
}
.ms-info-member img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-mid);
}
.ms-info-actions {
  display: grid;
  gap: 0.35rem;
  margin-top: 1.15rem;
}
.ms-info-actions--danger {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.ms-info-action {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.15rem;
  font-weight: 500;
  color: var(--text);
  font-size: 0.92rem;
}
.ms-info-action:hover { color: var(--primary); }
.ms-info-action--danger { color: var(--danger); }
.ms-info-action--danger:hover { color: color-mix(in srgb, var(--danger) 82%, #000); }
.ms-info-media-links {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 0.15rem;
}
.ms-info-action--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding: 0.78rem 0.1rem;
}
.ms-info-media-links .ms-info-action--row:last-child {
  border-bottom: 0;
}
.ms-info-action__chev {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
}

/* Emoji picker */
#msEmojiPicker,
.ms-emoji-picker {
  position: absolute;
  z-index: 45;
  width: min(18.5rem, calc(100vw - 1rem));
  max-height: min(20rem, calc(100vh - 2rem));
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.45rem;
  padding: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 0.75rem);
  box-shadow: var(--shadow-md);
  animation: ms-rise 160ms var(--ease) both;
}
.ms-emoji-picker__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.ms-emoji-picker__tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.ms-emoji-picker__tabs::-webkit-scrollbar { display: none; }
.ms-emoji-picker__tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: pointer;
}
.ms-emoji-picker__tab.is-active,
.ms-emoji-picker__tab[aria-selected="true"] {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
.ms-emoji-picker__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.15rem;
  overflow: auto;
  max-height: 11.5rem;
  padding-right: 0.1rem;
}
.ms-emoji-picker__grid.is-stickers {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}
.ms-emoji-picker__sticker {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 0.35rem;
  cursor: pointer;
}
.ms-emoji-picker__sticker img {
  display: block;
  width: 100%;
  height: auto;
}
.ms-msg-sticker {
  display: block;
  width: 7.5rem;
  height: 7.5rem;
  object-fit: contain;
  margin: 0.15rem 0;
}
.ms-msg-bubble.has-sticker {
  background: transparent;
  box-shadow: none;
  padding: 0.15rem 0;
}
.ms-link-chip {
  cursor: pointer;
}
.ms-pinned-bar__receipt {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.ms-emoji-picker__emoji {
  border: 0;
  background: transparent;
  border-radius: 0.45rem;
  font-size: 1.25rem;
  line-height: 1.2;
  padding: 0.28rem 0;
  cursor: pointer;
}
.ms-emoji-picker__emoji:hover,
.ms-emoji-picker__emoji:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.ms-emoji-picker__emoji--quick {
  font-size: 1.35rem;
  padding: 0.2rem 0.35rem;
}
.ms-emoji-picker__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Legacy reaction picker hook (unused) */
#msReactionPicker {
  position: absolute;
  z-index: 40;
  display: flex;
  gap: 0.2rem;
  padding: 0.35rem 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  animation: ms-rise 160ms var(--ease) both;
}

/* Alerts in login */
.ms-login .alert {
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

/* ——— Responsive: phone (<768), tablet (768–1199), desktop (1200+) ——— */

/* Phone: single-pane navigation */
@media (max-width: 767.98px) {
  .ms-shell.is-thread-open .ms-topbar {
    display: none;
  }

  .ms-grid.is-thread-open .ms-col--sidebar {
    display: none;
  }

  .ms-grid:not(.is-thread-open):not(.is-inbox-empty) .ms-col--thread {
    display: none;
  }

  /* No conversations yet — show welcome / new message pane instead of empty sidebar */
  .ms-grid.is-inbox-empty:not(.is-thread-open) .ms-col--sidebar {
    display: none;
  }

  .ms-grid.is-inbox-empty:not(.is-thread-open) .ms-col--thread {
    display: flex;
  }

  .ms-col--sidebar,
  .ms-col--thread {
    width: 100%;
    max-width: 100%;
  }

  .ms-thread-host {
    animation: ms-slide-in 300ms var(--ease) both;
  }

  .ms-sidebar__head {
    padding: 0.85rem 0.85rem 0.75rem;
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
    gap: 0.75rem;
  }

  .ms-sidebar__toolbar {
    flex-wrap: nowrap;
  }

  .ms-sidebar__toolbar .ms-icon-btn--compose {
    display: none;
  }

  .ms-sidebar__head-row {
    display: none;
  }

  .ms-cohort-filter {
    margin-top: 0;
  }

  .ms-inbox-scroll {
    -webkit-overflow-scrolling: touch;
  }

  .ms-inbox-item {
    padding: 0.85rem 0.75rem;
    min-height: 4.25rem;
  }

  .ms-inbox-item__avatar {
    width: 3rem;
    height: 3rem;
  }

  .ms-icon-btn,
  .ms-thread-header__back,
  .ms-ghost-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  .ms-thread-header {
    padding: 0.65rem 0.75rem;
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
    gap: 0.55rem;
  }

  .ms-thread-header__avatar {
    width: 2.35rem;
    height: 2.35rem;
  }

  .ms-thread-header__actions .ms-ghost-btn {
    width: 2.35rem;
    height: 2.35rem;
  }

  .ms-thread-header__title {
    font-size: 0.95rem;
  }

  .ms-thread-header__sub,
  .ms-thread-header__course {
    font-size: 0.72rem;
  }

  .ms-shell.is-thread-open .ms-thread-header {
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  }

  .ms-thread-header__back {
    display: grid;
  }

  .ms-messages {
    padding: 0.75rem 0.65rem 0.35rem;
    -webkit-overflow-scrolling: touch;
  }

  .ms-msg-row {
    max-width: min(92%, 22rem);
  }

  .ms-msg-row__avatar {
    width: 1.75rem;
    height: 1.75rem;
    margin-bottom: 1rem;
  }

  .ms-msg-row__menu {
    display: grid;
    align-self: flex-start;
    margin-top: 0.2rem;
    opacity: 1;
    pointer-events: auto;
  }

  .ms-msg-row.is-pressed .ms-msg-bubble {
    transform: scale(0.985);
    transition: transform 120ms var(--ease);
  }

  .ms-msg-image,
  .ms-msg-row.is-out .ms-msg-image {
    max-width: min(280px, 82vw);
  }

  .ms-composer {
    padding: 0.55rem 0.65rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    position: sticky;
    bottom: 0;
    z-index: 4;
  }

  .ms-composer__row {
    gap: 0.35rem;
  }

  .ms-composer__tool,
  .ms-composer__send,
  .ms-composer__rec-cancel,
  .ms-composer__rec-send {
    width: 2.55rem;
    height: 2.55rem;
  }

  .ms-composer__announce,
  .ms-composer__pro-only {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    margin-bottom: 0.15rem;
  }

  .ms-composer__input {
    font-size: 16px; /* prevent iOS zoom on focus */
  }

  .ms-empty-state {
    padding: 1.5rem 1rem;
  }

  .ms-empty-state h2 {
    font-size: 1.15rem;
  }

  .ms-newchat-panel {
    position: fixed;
    inset: 0;
    z-index: 80;
    border: 0;
    background: var(--surface);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .ms-newchat {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: calc(0.85rem + env(safe-area-inset-top, 0px)) 0.85rem 1rem;
  }

  .ms-newchat__list {
    max-height: none;
    flex: 1;
    min-height: 12rem;
  }

  .ms-newchat__item {
    min-height: 3.25rem;
    padding: 0.75rem 0.85rem;
  }

  .ms-action-sheet__card {
    width: 100%;
    max-height: min(85vh, 100%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-radius: 1rem 1rem 0 0;
  }

  .ms-action-sheet__btn {
    min-height: 3rem;
    font-size: 1rem;
  }

  .ms-modal__dialog {
    width: min(100%, 28rem);
    margin: 0.75rem;
  }

  .ms-topbar {
    padding-left: calc(0.85rem + env(safe-area-inset-left, 0px));
    padding-right: calc(0.85rem + env(safe-area-inset-right, 0px));
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  }

  .ms-login {
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .ms-info-drawer__card {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Tablet: split sidebar + thread, no info column */
@media (min-width: 768px) {
  .ms-grid .ms-col--thread {
    display: flex !important;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .ms-col--sidebar {
    position: relative;
  }

  .ms-newchat-panel {
    position: absolute;
    inset: 0;
    z-index: 25;
    background: var(--surface);
    overflow-y: auto;
    box-shadow: var(--shadow-md);
  }

  .ms-newchat__list {
    max-height: none;
    flex: 1;
  }

  .ms-msg-row {
    max-width: min(75%, 24rem);
  }

  .ms-col--info {
    display: none !important;
  }
}

/* Desktop: show info column */
@media (max-width: 1199.98px) {
  .ms-col--info { display: none !important; }
}

@media (min-width: 768px) {
  .ms-msg-row {
    max-width: min(72%, 26rem);
  }
}

@media (min-width: 1200px) {
  .ms-msg-row {
    max-width: min(68%, 28rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes ms-slide-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes ms-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ms-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ms-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ms-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(18px, 12px); }
}
@keyframes ms-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-3px); opacity: 1; }
}
@keyframes ms-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes ms-spin {
  to { transform: rotate(360deg); }
}
@keyframes ms-inbox-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes ms-pulse-soft {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ——— Deferred loading / skeletons ——— */
.ms-skel {
  display: block;
  border-radius: 999px;
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--border) 85%, var(--surface)) 0%,
    color-mix(in srgb, var(--primary) 16%, var(--surface)) 40%,
    color-mix(in srgb, var(--border) 85%, var(--surface)) 80%
  );
  background-size: 200% 100%;
  animation: ms-shimmer 1.15s ease-in-out infinite;
}
.ms-skel--avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.ms-skel--avatar-sm {
  width: 2rem;
  height: 2rem;
}
.ms-skel--line {
  height: 0.7rem;
  max-width: 100%;
}
.ms-skel--short { height: 0.55rem; }
.ms-skel--meta {
  width: 4.5rem;
  height: 0.5rem;
  margin-top: 0.35rem;
  opacity: 0.85;
}
.ms-skel--block {
  height: 3.2rem;
  border-radius: var(--radius-sm);
  margin: 0.85rem 0;
}
.ms-skel--bubble {
  height: 2.6rem;
  border-radius: 1.1rem;
  max-width: 100%;
}

.ms-skel-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem 1rem;
}
.ms-skel-inbox {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.65rem;
  border-radius: var(--radius-sm);
  animation: ms-inbox-in 320ms var(--ease) both;
  animation-delay: calc(var(--ms-i, 0) * 45ms);
}
.ms-skel-inbox__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ms-skel-inbox__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.ms-skel-messages {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.75rem 0.35rem 1rem;
}
.ms-skel-msg {
  display: flex;
  flex-direction: column;
  animation: ms-msg-in 360ms var(--ease) both;
  animation-delay: calc(var(--ms-i, 0) * 55ms);
}
.ms-skel-msg.is-in { align-items: flex-start; }
.ms-skel-msg.is-out { align-items: flex-end; }
.ms-skel-msg.is-out .ms-skel--bubble {
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--primary) 22%, var(--surface)) 0%,
    color-mix(in srgb, var(--primary) 34%, var(--surface)) 45%,
    color-mix(in srgb, var(--primary) 22%, var(--surface)) 80%
  );
  background-size: 200% 100%;
  animation: ms-shimmer 1.15s ease-in-out infinite;
}

.ms-skel-info {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.25rem 0;
  animation: ms-fade 280ms var(--ease) both;
}
.ms-skel-info__people {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.ms-skel-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem;
}
.ms-skel-contact {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.45rem;
  animation: ms-inbox-in 280ms var(--ease) both;
  animation-delay: calc(var(--ms-i, 0) * 40ms);
}

.ms-inbox-item-wrap {
  animation: ms-inbox-in 320ms var(--ease) both;
  animation-delay: calc(var(--ms-i, 0) * 28ms);
}
.ms-inbox-item-wrap.is-entering {
  animation-name: ms-inbox-in;
}

.ms-thread.is-loading .ms-composer-mount,
.ms-thread.is-loading #msComposerMount {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.15);
  transition: opacity 220ms var(--ease);
}
.ms-thread.is-ready #msComposerMount {
  opacity: 1;
  pointer-events: auto;
  animation: ms-rise 320ms var(--ease) both;
}
.ms-thread-header__title.is-loading {
  position: relative;
  color: transparent;
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--border) 80%, var(--surface)) 0%,
    color-mix(in srgb, var(--text-muted) 18%, var(--surface)) 45%,
    color-mix(in srgb, var(--border) 80%, var(--surface)) 80%
  );
  background-size: 200% 100%;
  animation: ms-shimmer 1.15s ease-in-out infinite;
  border-radius: 0.4rem;
  min-width: 8rem;
  min-height: 1.15em;
}
.ms-thread-header__sub.is-loading {
  min-height: 0.85em;
  width: 9rem;
  border-radius: 0.35rem;
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--border) 80%, var(--surface)) 0%,
    color-mix(in srgb, var(--text-muted) 18%, var(--surface)) 45%,
    color-mix(in srgb, var(--border) 80%, var(--surface)) 80%
  );
  background-size: 200% 100%;
  animation: ms-shimmer 1.15s ease-in-out infinite;
  color: transparent;
}

.ms-messages.is-revealing .ms-msg-row {
  animation: ms-msg-in 380ms var(--ease) both;
  animation-delay: calc(var(--ms-i, 0) * 32ms);
}
.ms-msg-row.is-deferred-in {
  animation: ms-msg-in 320ms var(--ease) both;
}

.ms-load-older-spin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem 0.5rem;
  margin: 0.25rem auto 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  animation: ms-fade 200ms var(--ease) both;
}
.ms-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ms-spin 0.7s linear infinite;
}
.ms-spinner--lg {
  width: 1.65rem;
  height: 1.65rem;
  border-width: 2.5px;
}
.ms-info-panel.is-deferred {
  animation: ms-rise 360ms var(--ease) both;
}
.ms-thread-host.is-swapping {
  animation: ms-fade 220ms var(--ease) both;
}

.ms-inbox-item__muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-2);
  vertical-align: middle;
}
.ms-inbox-item__muted svg {
  width: 0.75rem;
  height: 0.75rem;
}
.ms-inbox-item.is-muted .ms-inbox-item__preview { opacity: 0.85; }
.ms-info-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.ms-staff-banner {
  margin: 0 0.75rem 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
}
.ms-staff-banner__text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.ms-notif-prompt {
  margin: 0 0.75rem 0.65rem;
  padding: 0.85rem 0.9rem 0.8rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.ms-email-verify-banner {
  margin: 0.65rem 0.75rem 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent, #e07a3d) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent, #e07a3d) 28%, var(--border));
  display: grid;
  gap: 0.55rem;
}
.ms-email-verify-banner__text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
}
.ms-notif-prompt--enable {
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.ms-notif-prompt--blocked {
  background: color-mix(in srgb, #b45309 10%, var(--surface));
  border: 1px solid color-mix(in srgb, #b45309 28%, var(--border));
}
.ms-notif-prompt__header {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}
.ms-notif-prompt__icon {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ms-notif-prompt__icon svg {
  width: 1.1rem;
  height: 1.1rem;
}
.ms-notif-prompt__icon--enable {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
}
.ms-notif-prompt__icon--blocked {
  background: color-mix(in srgb, #b45309 16%, var(--surface));
  color: #9a3412;
}
.ms-notif-prompt__copy {
  flex: 1;
  min-width: 0;
}
.ms-notif-prompt__title {
  margin: 0 0 0.2rem;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.ms-notif-prompt__text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.ms-notif-prompt__close {
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
  margin: -0.15rem -0.15rem 0 0;
}
.ms-notif-prompt__close:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}
.ms-notif-prompt__details {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.ms-notif-prompt__details summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
.ms-notif-prompt__details summary::-webkit-details-marker {
  display: none;
}
.ms-notif-prompt__details summary::before {
  content: '▸ ';
  color: var(--text-muted);
}
.ms-notif-prompt__details[open] summary::before {
  content: '▾ ';
}
.ms-notif-prompt__steps {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.ms-notif-prompt__steps li + li {
  margin-top: 0.25rem;
}
.ms-notif-prompt__status {
  margin: 0.55rem 0 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #9a3412;
}
.ms-notif-prompt__body {
  display: grid;
  gap: 0.55rem;
}
.ms-notif-prompt__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.65rem;
}
.ms-notif-prompt__actions .btn-link {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  font-size: 0.78rem;
  text-decoration: none;
}
[data-theme="dark"] .ms-notif-prompt--blocked {
  background: color-mix(in srgb, #b45309 14%, var(--surface));
}
[data-theme="dark"] .ms-notif-prompt__icon--blocked {
  color: #fdba74;
}
[data-theme="dark"] .ms-notif-prompt__status {
  color: #fdba74;
}
.ms-welcome-bar {
  margin: 0 1rem 0.35rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
}
.ms-welcome-bar__text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
}
.ms-composer__blocked {
  margin: 0 0.85rem 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--border));
  color: var(--danger);
  font-size: 0.82rem;
}
.ms-settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.ms-settings-toggle input { margin-top: 0.2rem; }
.ms-settings-hint {
  margin: 0;
  line-height: 1.35;
}
.ms-muted-tag {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ms-toasts {
  position: fixed;
  left: 50%;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(22rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.ms-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.8rem 0.75rem 0.8rem 0.95rem;
  border-radius: 0.85rem;
  background: #1f1a24;
  color: #fff;
  box-shadow: 0 12px 32px rgba(20, 16, 28, 0.28), 0 2px 8px rgba(20, 16, 28, 0.12);
  font-size: 0.875rem;
  line-height: 1.35;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: ms-toast-in 220ms var(--ease) both;
}
.ms-toast.is-leaving {
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  animation: none;
}
.ms-toast__body {
  flex: 1;
  min-width: 0;
}
.ms-toast__text {
  display: block;
  word-break: break-word;
}
.ms-toast--success { background: #1f7a54; }
.ms-toast--error { background: #a33b3b; }
.ms-toast--info { background: #1f1a24; }
.ms-toast--message {
  background: color-mix(in srgb, var(--primary) 88%, #111);
}
.ms-toast__action {
  flex-shrink: 0;
  align-self: center;
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.ms-toast__action:hover {
  background: rgba(255,255,255,0.24);
}
.ms-toast__close {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin: -0.15rem -0.15rem 0 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ms-toast__close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
@keyframes ms-toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (min-width: 768px) {
  .ms-toasts {
    left: auto;
    right: 1rem;
    top: auto;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: none;
  }
  @keyframes ms-toast-in {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
  .ms-toast.is-leaving {
    transform: translateY(8px) scale(0.97);
  }
}

.ms-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.ms-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 24, 0.45);
}
.ms-modal__card {
  position: relative;
  width: min(26rem, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: ms-rise 180ms var(--ease) both;
  overflow: hidden;
}
.ms-modal__card--wide {
  width: min(36rem, 100%);
}
.ms-modal__card--events-admin {
  width: min(42rem, calc(100vw - 1.5rem));
}
.ms-modal__panel,
.ms-modal__panel--sheet {
  position: relative;
  width: min(26rem, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: ms-rise 180ms var(--ease) both;
  overflow: hidden;
}
.ms-prompt-textarea {
  display: block;
  width: 100%;
  min-height: 8rem;
  max-height: min(50vh, 28rem);
  resize: vertical;
  line-height: 1.45;
  white-space: pre-wrap;
}
.ms-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ms-modal__head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.ms-modal__close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0 0.2rem;
}
.ms-modal__body { padding: 1rem; }
.ms-modal__body--scroll {
  max-height: min(78vh, 44rem);
  overflow-y: auto;
}
.ms-modal__text {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.ms-modal__quote {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text);
}
.ms-modal__list,
.ms-modal__radios {
  display: grid;
  gap: 0.4rem;
}
.ms-modal__choice,
.ms-modal__radio {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  cursor: pointer;
}
.ms-modal__choice:hover,
.ms-modal__radio:hover { background: var(--primary-soft); }
.ms-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.ms-modal--picker {
  align-items: stretch;
  padding: 0;
}
.ms-modal__card--picker {
  width: min(28rem, 100%);
  max-height: min(92vh, 40rem);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: auto;
}
.ms-modal__body--picker {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}
.ms-modal__radios--picker {
  flex: 1;
  min-height: 12rem;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ms-modal__actions--sticky {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--surface);
}
@media (min-width: 768px) {
  .ms-modal--picker {
    align-items: center;
    padding: 1rem;
  }
  .ms-modal__card--picker {
    margin-top: 0;
    border-radius: var(--radius);
    max-height: min(85vh, 36rem);
  }
}

/* Login forgot */
.ms-login__forgot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  margin-top: 0.35rem;
}
.ms-login__sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.ms-login__forgot .btn-link { color: var(--text-muted); }
.ms-login__forgot .btn-link:hover { color: var(--primary); }

/* Empty state CTAs */
.ms-empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.85rem;
}
.ms-inbox-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.ms-inbox-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.65rem;
}

/* Sidebar ghost icon + user chip */
.ms-icon-btn--ghost {
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid var(--border);
}
.ms-icon-btn--ghost:hover {
  background: var(--primary-soft);
}
.ms-user-chip__actions {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-shrink: 0;
}
.ms-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.ms-chip-btn:hover {
  color: var(--text);
  background: var(--surface);
}
.ms-chip-btn--icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
}
.ms-chip-btn--icon svg {
  width: 1rem;
  height: 1rem;
}
.ms-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Profile menu */
.ms-profile__trigger {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.ms-profile__trigger:hover,
.ms-profile__trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.ms-profile__trigger--sm {
  width: 2.35rem;
  height: 2.35rem;
}
.ms-profile__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ms-profile-menu {
  position: fixed;
  z-index: 85;
  width: min(16rem, calc(100vw - 1.5rem));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: ms-rise 160ms var(--ease) both;
}
.ms-profile-menu__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}
.ms-profile-menu__avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--primary-mid);
}
.ms-profile-menu__meta {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}
.ms-profile-menu__meta strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-profile-menu__meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-profile-menu__group {
  padding: 0.35rem;
}
.ms-profile-menu__group--danger {
  border-top: 1px solid var(--border);
}
.ms-profile-menu__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.65rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
}
.ms-profile-menu__item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.ms-profile-menu__item--danger {
  color: var(--danger);
}
.ms-profile-menu__item--danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}
.ms-profile-menu__item--muted {
  color: var(--text-muted);
  cursor: default;
}
.ms-profile-menu__item--muted:hover {
  background: transparent;
  color: var(--text-muted);
}
.ms-profile-menu__icon {
  width: 1.05rem;
  height: 1.05rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ms-profile-menu__icon svg {
  width: 100%;
  height: 100%;
}
.ms-thread-header__profile {
  display: inline-flex;
  flex-shrink: 0;
}
.ms-thread-header__profile .ms-profile__trigger {
  width: 2.1rem;
  height: 2.1rem;
}

/* Inbox mark unread */
.ms-inbox-item-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.ms-inbox-item-wrap .ms-inbox-item { flex: 1; }
.ms-inbox-item__mark-unread {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  opacity: 0;
  display: grid;
  place-items: center;
  transition: opacity 140ms var(--ease);
}
.ms-inbox-item__mark-unread svg {
  width: 0.65rem;
  height: 0.65rem;
  fill: currentColor;
  stroke: none;
}
.ms-inbox-item-wrap:hover .ms-inbox-item__mark-unread,
.ms-inbox-item-wrap:focus-within .ms-inbox-item__mark-unread { opacity: 1; }
.ms-inbox-item__mark-unread:hover { background: var(--primary-soft); color: var(--primary); }

/* Group create + blocks */
.ms-group-create__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  margin: 0;
}
.ms-group-create__item:last-child { border-bottom: 0; }
.ms-group-create__item:hover { background: var(--primary-soft); }
.ms-group-create__item input { flex-shrink: 0; }
.ms-group-create__count { padding: 0 0.15rem; }
.ms-blocks-panel__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.ms-blocks-panel__item:last-child { border-bottom: 0; }
.ms-blocks-panel__item .ms-newchat__meta { flex: 1; min-width: 0; }

/* Pinned bar */
.ms-pinned-bar {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  margin: 0 0.75rem 0.35rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  overflow: hidden;
}
.ms-pinned-bar__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.7rem;
  min-width: 0;
}
.ms-pinned-bar__label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.ms-pinned-bar__text {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ms-pinned-bar__unpin {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0 0.7rem;
  font-size: 1.2rem;
  line-height: 1;
}
.ms-pinned-bar__unpin:hover { color: var(--danger); }

/* Thread search results */
.ms-thread-search__results {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: calc(100% - 0.15rem);
  z-index: 12;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.ms-thread-search__hit {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
}
.ms-thread-search__hit:last-child { border-bottom: 0; }
.ms-thread-search__hit:hover { background: var(--primary-soft); }
.ms-thread-search__hit strong { font-size: 0.75rem; color: var(--text-muted); }

/* Action sheet — bottom sheet on mobile, centered card on desktop */
.ms-action-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ms-action-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 24, 0.4);
}
.ms-action-sheet__card {
  position: relative;
  width: min(28rem, 100%);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-md);
  animation: ms-rise 180ms var(--ease) both;
  max-height: 70vh;
  overflow: auto;
}
@media (min-width: 768px) {
  .ms-action-sheet {
    align-items: center;
    padding: 1.25rem;
  }
  .ms-action-sheet__card {
    border-radius: 1rem;
    width: min(22rem, 100%);
    max-height: min(70vh, 32rem);
  }
}
.ms-action-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ms-action-sheet__body {
  display: grid;
  padding: 0.35rem 0 0.75rem;
}
.ms-action-sheet__group {
  border-bottom: 1px solid var(--border);
}
.ms-action-sheet__group:last-child {
  border-bottom: 0;
}
.ms-action-sheet__preview {
  margin: 0;
  padding: 0.55rem 1.1rem 0.35rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-action-sheet__btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.85rem 1.1rem;
  font-weight: 500;
  color: var(--text);
}
.ms-action-sheet__btn:hover { background: var(--primary-soft); }
.ms-action-sheet__btn--danger { color: var(--danger); }

/* Mobile info drawer */
.ms-info-drawer {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ms-info-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 24, 0.4);
  backdrop-filter: blur(2px);
}
.ms-info-drawer__card {
  position: relative;
  width: min(28rem, 100%);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-md);
  animation: ms-rise 180ms var(--ease) both;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ms-info-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.ms-info-drawer__body {
  flex: 1;
  min-height: 0;
  padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.ms-info-drawer__section {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}
.ms-info-drawer__members {
  display: grid;
  gap: 0.55rem;
}

/* File / link chips, mentions, announcements */
.ms-file-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  max-width: min(260px, 72vw);
  margin: 0.2rem 0;
}
.ms-msg-row.is-out .ms-file-chip {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}
.ms-file-chip__icon { font-size: 1.1rem; }
.ms-file-chip__meta {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}
.ms-file-chip__meta strong {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-file-chip__meta small {
  font-size: 0.7rem;
  opacity: 0.8;
}
.ms-link-chip {
  display: inline-block;
  margin: 0.25rem 0.25rem 0 0;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-msg-row.is-out .ms-link-chip {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.ms-mention {
  font-weight: 600;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 0.25rem;
  padding: 0 0.15rem;
}
.ms-msg-row.is-out .ms-mention {
  color: #fff;
  background: rgba(255,255,255,0.18);
}
.ms-msg-announce {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.ms-msg-row.is-announcement .ms-msg-bubble {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
}
.ms-msg-edited,
.ms-msg-seen {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.ms-msg-row.is-out .ms-msg-seen { color: color-mix(in srgb, var(--primary) 40%, #fff); }
.ms-msg-row.is-flash .ms-msg-bubble {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.ms-composer__announce {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.85rem 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}
.ms-composer__pro-only {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.85rem 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}
.ms-msg-pro-locked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.35rem 0.15rem;
  max-width: 18rem;
}
.ms-msg-pro-locked__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
}
.ms-msg-pro-locked__kind {
  font-size: 0.9rem;
}
.ms-msg-pro-locked__snippet,
.ms-pro-teaser__snippet {
  width: 100%;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
  filter: blur(4px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  max-height: 2.9em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 20%, transparent 95%);
  mask-image: linear-gradient(180deg, #000 20%, transparent 95%);
}
.ms-msg-pro-locked__meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.ms-msg-pro-locked__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.ms-event-detail__desc--teaser {
  margin-bottom: 0.75rem;
}
.ms-msg-pro-locked strong {
  font-size: 0.9rem;
}
.ms-msg-bubble.has-pro-locked {
  min-width: 12rem;
}
.ms-auth-media-pending:not([src]),
.ms-auth-media-pending[src=""],
img.ms-auth-media-pending:not([src]),
img.ms-auth-media-pending[src=""] {
  min-width: 120px;
  min-height: 80px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--surface) 88%, var(--border)) 0%,
      color-mix(in srgb, var(--surface) 70%, var(--border)) 45%,
      color-mix(in srgb, var(--surface) 88%, var(--border)) 100%);
  background-size: 200% 100%;
  animation: ms-media-shimmer 1.1s ease-in-out infinite;
  object-fit: cover;
}
.ms-msg-reply__thumb.ms-auth-media-pending:not([src]),
.ms-msg-reply__thumb.ms-auth-media-pending[src=""],
.ms-composer__reply-thumb.ms-auth-media-pending:not([src]),
.ms-composer__reply-thumb.ms-auth-media-pending[src=""] {
  min-width: 2rem;
  min-height: 2rem;
  width: 2rem;
  height: 2rem;
}
.ms-composer__reply-thumb.ms-auth-media-pending:not([src]),
.ms-composer__reply-thumb.ms-auth-media-pending[src=""] {
  min-width: 2.25rem;
  min-height: 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
}
.ms-auth-media-pending.is-auth-media-failed,
img.is-auth-media-failed {
  opacity: 1;
  animation: none;
  background: color-mix(in srgb, var(--surface) 82%, var(--border));
  position: relative;
}
.ms-auth-media-pending.is-auth-media-failed::after,
img.is-auth-media-failed::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    center / 42% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Ccircle cx='8.5' cy='10' r='1.5'/%3E%3Cpath d='M21 16l-5-5-4 4-2-2-5 5'/%3E%3C/svg%3E");
  opacity: 0.85;
}
@keyframes ms-media-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
button.ms-file-chip {
  appearance: none;
  border: none;
  background: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.ms-msg-row.is-pro-locked .ms-msg-bubble {
  background: color-mix(in srgb, var(--surface) 92%, var(--primary-soft));
  border: 1px dashed color-mix(in srgb, var(--primary) 35%, var(--border));
}
.ms-msg-bubble.has-pro-sent {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
}
.ms-msg-pro-sent__label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.ms-composer__file-badge {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ms-composer__mentions {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(100% - 0.25rem);
  z-index: 15;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 10rem;
  overflow: auto;
}
.ms-composer { position: relative; }
.ms-composer__mention-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
}
.ms-composer__mention-item:last-child { border-bottom: 0; }
.ms-composer__mention-item:hover { background: var(--primary-soft); }

.ms-subgroups__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.ms-info-parent__link,
.ms-thread-header__parent {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.ms-info-parent__link:hover,
.ms-thread-header__parent:hover {
  text-decoration: underline;
}

.ms-thread-header__course {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.ms-thread-header__course-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ms-modal__radio.has-membership {
  align-items: flex-start;
}

.ms-modal__radio-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ms-modal__radio-name {
  line-height: 1.35;
}

.ms-picker-membership {
  display: block;
  color: var(--warning-text, #9a6700);
  font-size: 0.75rem;
  line-height: 1.3;
}

.ms-picker-note {
  line-height: 1.45;
}

/* —— Messenger polish —— */
:root {
  --ms-vvh: 100dvh;
}

.ms-composer {
  /* Sticky composer uses visual viewport height when mobile keyboard opens */
  padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
}

body.is-offline .ms-shell {
  padding-top: calc(2rem + env(safe-area-inset-top, 0px));
}

.ms-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  padding-top: max(0.45rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  font-size: 0.8rem;
  font-weight: 500;
}
.ms-offline-banner__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
.ms-offline-banner.d-none { display: none !important; }

.ms-sidebar__head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ms-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
#msNotifCenterBtn,
#msNotifCenterBtnDesk {
  position: relative;
}
.ms-notif-center__badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.ms-notif-center {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: start center;
  padding: 4rem 1rem 1rem;
}
.ms-notif-center__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 28, 0.45);
  border: 0;
}
.ms-notif-center__card {
  position: relative;
  width: min(420px, 100%);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.ms-notif-center__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ms-notif-center__head-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.ms-notif-center__body {
  overflow: auto;
  flex: 1;
}
.ms-notif-center__item {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.75rem 1rem;
}
.ms-notif-center__item.is-unread {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.ms-notif-center__item.is-unread strong {
  font-weight: 700;
}
.ms-notif-center__item:hover { background: var(--primary-soft); }
.ms-notif-center__item strong { font-size: 0.875rem; }
.ms-notif-center__item span {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-notif-center__item small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ms-mark-all-read {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  white-space: nowrap;
}
.ms-mark-all-read:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}
.ms-sidebar__toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ms-sidebar__toolbar .ms-search { flex: 1; min-width: 0; }

.ms-search-hits {
  margin: 0 0.65rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.ms-search-hits__head {
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ms-search-hits__item {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.6rem 0.75rem;
}
.ms-search-hits__item:last-child { border-bottom: 0; }
.ms-search-hits__item:hover { background: var(--primary-soft); }
.ms-search-hits__item strong { font-size: 0.82rem; }
.ms-search-hits__item span {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-inbox-item__tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0.1rem 0 0.15rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ms-inbox-item__tag--subgroup {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.ms-inbox-item__tag--course {
  background: var(--primary-soft);
  color: var(--primary);
}
.ms-inbox-item__tag--cohort {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}
.ms-inbox-item__tag--course-wide {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary);
}
.ms-inbox-item__tag--course-dm {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.ms-inbox-item__avatar--course-dm,
.ms-thread-header__avatar--course-dm {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.ms-inbox-item__avatar--course-dm svg,
.ms-thread-header__avatar--course-dm svg {
  width: 55%;
  height: 55%;
}

.ms-inbox-item-wrap--swipe {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}
.ms-inbox-swipe__actions {
  position: absolute;
  inset: 0 0 0 auto;
  width: 148px;
  display: flex;
  z-index: 0;
}
.ms-inbox-swipe__btn {
  flex: 1;
  border: 0;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}
.ms-inbox-swipe__btn--unread { background: #3b6ea8; }
.ms-inbox-swipe__btn--mute { background: #6b5b7a; }
.ms-inbox-swipe__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  width: 100%;
  background: var(--surface);
  will-change: transform;
}
.ms-inbox-swipe__content .ms-inbox-item { flex: 1; }
.ms-inbox-item-wrap--swipe .ms-inbox-item__mark-unread {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
}

.ms-role-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary);
  vertical-align: middle;
}
.ms-gender-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.3rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  vertical-align: middle;
  background: color-mix(in srgb, var(--text-muted, #6b7280) 14%, transparent);
  color: var(--text-muted, #6b7280);
}
.ms-gender-badge--male {
  background: color-mix(in srgb, #3b82f6 16%, transparent);
  color: #2563eb;
}
.ms-gender-badge--female {
  background: color-mix(in srgb, #db2777 14%, transparent);
  color: #be185d;
}
[data-theme="dark"] .ms-gender-badge--male {
  color: #93c5fd;
}
[data-theme="dark"] .ms-gender-badge--female {
  color: #f9a8d4;
}
.ms-msg-meta .ms-gender-badge,
.ms-msg-meta .ms-role-badge {
  margin-left: 0;
  margin-right: 0.15rem;
}

.ms-msg-announce--banner {
  display: block;
  width: 100%;
  margin: 0 0 0.4rem;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ms-msg-row.is-announcement .ms-msg-bubble {
  border: 1.5px solid color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: inset 3px 0 0 var(--accent);
}

.ms-msg-delivery {
  font-size: 0.7rem;
  margin-left: 0.25rem;
  color: var(--text-muted);
}
.ms-msg-delivery.is-seen { color: color-mix(in srgb, var(--primary) 55%, #fff); font-weight: 600; }
.ms-msg-delivery.is-failed { color: var(--danger); cursor: pointer; font-weight: 600; }
.ms-msg-row.is-out .ms-msg-delivery.is-sent,
.ms-msg-row.is-out .ms-msg-delivery.is-sending {
  color: color-mix(in srgb, #fff 70%, var(--primary));
}
.ms-msg-row.is-out.is-pending .ms-msg-bubble,
.ms-msg-row.is-out:has(.ms-msg-delivery.is-sending) .ms-msg-bubble {
  opacity: 0.88;
}
.ms-msg-row.is-out:has(.ms-msg-delivery.is-failed) .ms-msg-bubble {
  opacity: 0.78;
  outline: 1px dashed color-mix(in srgb, var(--danger) 55%, transparent);
}

.ms-composer__failed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  font-size: 0.8rem;
  color: var(--danger);
}
.ms-composer__failed-text { flex: 1; }

.ms-link-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  padding: 0.3rem 0.55rem;
  border-radius: 10px;
  white-space: normal;
}
.ms-link-chip__domain {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.85;
}
.ms-link-chip__url {
  font-size: 0.72rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-msg-image {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 10px;
  overflow: hidden;
  max-width: min(320px, 78vw);
}
.ms-msg-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  position: relative;
}

.ms-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 0;
}
.ms-lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
}
.ms-lightbox__stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 3.5rem 1rem 4.5rem;
}
.ms-lightbox__img {
  max-width: min(100vw, 1100px);
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}
.ms-lightbox__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}
.ms-lightbox__download {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.ms-lightbox__download:hover {
  background: rgba(255, 255, 255, 0.24);
}
.ms-lightbox__download:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.ms-lightbox__download-icon {
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
}
.ms-lightbox__download-icon svg {
  width: 100%;
  height: 100%;
}
.ms-lightbox__close {
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.ms-voice-player {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 13rem;
  max-width: 18rem;
  padding: 0.25rem 0.2rem;
}
.ms-voice-player__play,
.ms-voice-player__speed {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ms-voice-player__play svg {
  width: 0.95rem;
  height: 0.95rem;
}
.ms-voice-player__speed {
  width: auto;
  padding: 0 0.4rem;
  font-size: 0.65rem;
}
.ms-msg-row.is-out .ms-voice-player__play,
.ms-msg-row.is-out .ms-voice-player__speed {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.ms-voice-player__track {
  position: relative;
  flex: 1;
  height: 1.85rem;
  cursor: pointer;
  border-radius: 0.35rem;
  overflow: hidden;
}
.ms-voice-player__wave {
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 100%;
  position: relative;
  z-index: 1;
}
.ms-voice-player__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  pointer-events: none;
  z-index: 0;
}
.ms-msg-row.is-out .ms-voice-player__progress {
  background: rgba(255, 255, 255, 0.18);
}
.ms-voice-player__wave span {
  flex: 1;
  height: var(--h, 40%);
  border-radius: 2px;
  background: color-mix(in srgb, var(--primary) 45%, transparent);
  min-width: 2px;
}
.ms-msg-row.is-out .ms-voice-player__wave span {
  background: rgba(255, 255, 255, 0.55);
}
.ms-voice-player.is-playing .ms-voice-player__wave span {
  animation: ms-voice-pulse 0.9s ease-in-out infinite alternate;
}
.ms-voice-player__time {
  font-size: 0.68rem;
  color: var(--text-muted);
  min-width: 2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ms-msg-row.is-out .ms-voice-player__time { color: rgba(255, 255, 255, 0.8); }
@keyframes ms-voice-pulse {
  from { opacity: 0.55; transform: scaleY(0.85); }
  to { opacity: 1; transform: scaleY(1.05); }
}

.ms-jump-unread {
  position: absolute;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  z-index: 8;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}
.ms-thread { position: relative; }

.ms-info-notif-prefs {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.ms-info-notif-prefs__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.ms-info-notif-prefs__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
}
.ms-info-notif-prefs__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.45rem 0.3rem;
  line-height: 1.25;
}
.ms-info-notif-prefs__btn.is-active {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}
.ms-info-notif-prefs__hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.ms-action-sheet__hint {
  margin: 0 0 0.65rem;
  padding: 0 0.15rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.ms-action-sheet__btn.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.ms-forward-list {
  display: grid;
  gap: 0;
  max-height: 50vh;
  overflow: auto;
}
.ms-forward-list__item {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.7rem 0.25rem;
}
.ms-forward-list__item:hover { background: var(--primary-soft); }
.ms-forward-list__item strong { font-size: 0.875rem; }
.ms-forward-list__item span {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-msg-action.is-active { color: var(--accent); }

.ms-composer__mention-item--all {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* PWA install banner — visible on desktop and mobile when not installed */
.ms-pwa-update {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 160;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(92vw, 420px);
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(20, 16, 32, 0.2);
  animation: ms-pwa-in 0.3s ease-out;
}
.ms-pwa-update__text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.ms-pwa-update__btn {
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.ms-pwa-update__btn:hover {
  filter: brightness(1.06);
}

.ms-pwa-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 140;
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1rem 0.95rem;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
  background: var(--surface);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent),
    0 16px 40px rgba(20, 16, 32, 0.22);
  animation: ms-pwa-in 0.35s ease-out;
}
@keyframes ms-pwa-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ms-pwa-banner__close {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.ms-pwa-banner__close:hover {
  color: var(--text);
  background: var(--surface-2);
}
.ms-pwa-banner__body {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding-right: 1.5rem;
}
.ms-pwa-banner__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(20, 16, 32, 0.12);
}
.ms-pwa-banner__copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.ms-pwa-banner__copy strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ms-pwa-banner__copy span {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.ms-pwa-banner__actions {
  display: flex;
  justify-content: stretch;
  gap: 0.5rem;
}
.ms-pwa-banner__btn {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 0.95rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  min-height: 2.65rem;
}
.ms-pwa-banner__btn--ghost {
  background: var(--surface-2);
  color: var(--text-muted);
}
.ms-pwa-banner__btn--ghost:hover {
  color: var(--text);
}
.ms-pwa-banner__btn--primary {
  background: var(--primary);
  color: #fff;
}
.ms-pwa-banner__btn--primary:hover {
  filter: brightness(1.05);
}
.ms-pwa-guide {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: end center;
  padding: 0;
  background: rgba(15, 23, 42, 0.45);
}
.ms-pwa-guide__card {
  position: relative;
  width: min(100%, 26rem);
  margin: 0;
  padding: 1.25rem 1.15rem 1.15rem;
  border-radius: 1.1rem 1.1rem 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}
.ms-pwa-guide__close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.ms-pwa-guide__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(20, 16, 32, 0.12);
}
.ms-pwa-guide__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ms-pwa-guide__steps {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}
.ms-pwa-guide__actions {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.25rem;
}
@media (min-width: 720px) {
  .ms-pwa-guide {
    place-items: center;
  }
  .ms-pwa-guide__card {
    border-radius: 1.1rem;
    margin: 1rem;
  }
}
[data-theme="dark"] .ms-pwa-banner {
  background: color-mix(in srgb, var(--surface) 92%, #000);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent),
    0 18px 42px rgba(0, 0, 0, 0.45);
}
@media (min-width: 720px) {
  .ms-pwa-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(420px, calc(100vw - 48px));
  }
  .ms-pwa-banner__actions {
    justify-content: flex-end;
  }
  .ms-pwa-banner__btn {
    flex: 0 0 auto;
    min-width: 7.5rem;
  }
}

/* Share target picker */
.ms-share-picker {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: end center;
}
.ms-share-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 24, 0.45);
}
.ms-share-picker__card {
  position: relative;
  width: min(440px, 100%);
  max-height: min(72vh, 640px);
  overflow: auto;
  margin: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.9rem 0.9rem 1.1rem;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.18);
}
.ms-share-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.ms-share-picker__x {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.ms-share-picker__preview {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.ms-share-picker__list {
  display: grid;
}
.ms-share-picker__item {
  display: grid;
  gap: 0.1rem;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.7rem 0.2rem;
  cursor: pointer;
}
.ms-share-picker__item strong { font-size: 0.9rem; }
.ms-share-picker__item span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.ms-share-picker__item:hover { background: var(--primary-soft); }
@media (min-width: 720px) {
  .ms-share-picker { place-items: center; }
  .ms-share-picker__card {
    border-radius: 18px;
    margin: 1rem;
  }
}

/* Polls */
.ms-poll-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  background: rgba(15, 23, 42, 0.38);
  padding: 0;
}
.ms-poll-sheet__panel {
  width: min(100%, 28rem);
  max-height: min(90vh, 36rem);
  overflow: auto;
  background: var(--surface);
  border-radius: 1rem 1rem 0 0;
  padding: 1rem 1rem 1.25rem;
  box-shadow: var(--shadow-md);
}
.ms-poll-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.ms-poll-sheet__close {
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.ms-poll-sheet__field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ms-poll-sheet__field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}
.ms-poll-sheet__add,
.ms-poll-sheet__submit {
  width: 100%;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.7rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.ms-poll-sheet__add {
  background: transparent;
  color: var(--primary);
  margin-bottom: 0.65rem;
}
.ms-poll-sheet__check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
  color: var(--text);
}
.ms-poll-sheet__submit {
  background: var(--primary);
  color: #fff;
}
.ms-msg-bubble.has-poll {
  min-width: min(100%, 18rem);
  max-width: 22rem;
  padding: 0.45rem;
}
.ms-poll-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.35rem 0.25rem 0.15rem;
}
.ms-poll-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--primary);
}
.ms-poll-card__badge svg {
  width: 0.9rem;
  height: 0.9rem;
}
.ms-poll-card__question {
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}
.ms-poll-card__options {
  display: grid;
  gap: 0.4rem;
}
.ms-poll-option {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text);
  text-align: left;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
}
.ms-poll-option:disabled {
  cursor: default;
  opacity: 0.85;
}
.ms-poll-option.is-selected {
  border-color: var(--primary);
}
.ms-poll-option__bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  pointer-events: none;
}
.ms-poll-option__row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.ms-poll-option__label {
  font-size: 0.88rem;
  font-weight: 550;
}
.ms-poll-option__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.ms-poll-card__footer {
  font-size: 0.75rem;
  color: var(--text-muted);
}
@media (min-width: 720px) {
  .ms-poll-sheet {
    place-items: center;
  }
  .ms-poll-sheet__panel {
    border-radius: 1rem;
    margin: 1rem;
  }
}

.ms-msg-tombstone {
  margin: 0.35rem 0;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text-muted, #6b7280) 10%, transparent);
  color: var(--text-muted, #6b7280);
  font-size: 0.8rem;
  font-style: italic;
}
.ms-msg-reply-count {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}
.ms-link-chip--assignment,
.ms-link-chip--resource,
.ms-link-chip--lesson,
.ms-link-chip--checkin,
.ms-link-chip--portal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.ms-link-chip__kind {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary);
}
.ms-link-chip__sub {
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
}
.ms-gallery-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.ms-gallery-tabs__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
}
.ms-gallery-tabs__btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.ms-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.55rem;
}
.ms-gallery-grid.is-links {
  grid-template-columns: 1fr;
}
.ms-gallery-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  font-size: 0.75rem;
  color: var(--text);
  width: 100%;
  cursor: pointer;
}
.ms-gallery-item--image {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
}
.ms-gallery-item--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ms-gallery-item--link {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  gap: 0;
  grid-column: 1 / -1;
}
.ms-gallery-item__main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.65rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  min-width: 0;
}
.ms-gallery-item__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.ms-gallery-item__text strong,
.ms-gallery-item__text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-gallery-item__text small {
  color: var(--text-muted);
  font-size: 0.72rem;
}
.ms-gallery-item__jump {
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font-size: 0.95rem;
}
.ms-gallery-item__icon {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--primary);
  flex: 0 0 auto;
}
.ms-gallery-item__icon svg { width: 100%; height: 100%; }
.ms-poll-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.ms-poll-templates__btn {
  border: 1px solid var(--border);
  background: var(--surface-2, var(--surface));
  color: var(--text);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
}
.ms-session-row {
  display: grid;
  gap: 0.25rem;
}
.ms-session-row .btn {
  justify-self: start;
  margin-top: 0.25rem;
}

.ms-msg-delivery[data-read-detail] {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.ms-msg-edited {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
  font-size: inherit;
}
.ms-reply-thread-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.5rem 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.ms-reply-thread-bar__close {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.ms-audit-list {
  margin: 0;
  padding-left: 1.1rem;
}
.ms-audit-block {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.ms-audit-block:last-child { border-bottom: 0; }
.ms-audit-block__meta {
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}
.ms-audit-block__before,
.ms-audit-block__after {
  font-size: 0.82rem;
  margin-top: 0.2rem;
}
.ms-search-filters {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.75rem 0;
}
.ms-search-filters__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
}
.ms-search-filters__btn.is-active {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
.ms-search-hits__badge {
  font-size: 0.72rem;
  opacity: 0.8;
}

.ms-pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  color: #fff;
  background: linear-gradient(135deg, var(--accent, #e07a3d), color-mix(in srgb, var(--primary, #4f3f73) 70%, #000));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #e07a3d) 35%, transparent);
}
.ms-pro-badge--sm {
  font-size: 0.58rem;
  padding: 0.05rem 0.32rem;
}
.ms-profile-menu__meta .ms-pro-badge {
  margin-left: 0.25rem;
}
.ms-msg-meta__name .ms-pro-badge {
  margin-left: 0.2rem;
}
.ms-msg-meta__name--mine-pro {
  display: inline-flex;
  align-items: center;
}
.ms-thread-header__title .ms-pro-badge,
.ms-inbox-item__title .ms-pro-badge,
.ms-info-member__meta .ms-pro-badge,
.ms-newchat__name .ms-pro-badge,
.ms-info-panel h3 .ms-pro-badge {
  margin-left: 0.3rem;
  vertical-align: middle;
}

.ms-membership__hero {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.ms-membership__hero h2 {
  margin: 0;
  font-size: 1.15rem;
}
.ms-membership__price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}
.ms-membership__benefits {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--text-muted, #666);
}
.ms-membership__actions .btn {
  width: 100%;
}
.ms-membership--active .ms-membership__hero {
  align-items: flex-start;
}
.ms-membership__alert {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--accent, #e07a3d) 12%, transparent);
  color: var(--text, #222);
  font-size: 0.85rem;
}
.ms-membership__history {
  margin-top: 1rem;
  width: 100%;
}
.ms-membership__history h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.ms-membership__history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ms-membership__history-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted, #666);
}
.ms-membership__source {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted, #666);
}

.ms-modal__panel--wide {
  max-width: min(520px, calc(100vw - 1.5rem));
}

.ms-form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ms-form-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.65rem;
}
.ms-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
}
.ms-field input,
.ms-field textarea,
.ms-field select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--text);
}
.ms-field--narrow {
  min-width: 5.5rem;
}
.ms-field--check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.ms-field--check input {
  width: auto;
}
.ms-membership-admin__lead {
  margin: 0 0 0.35rem;
  color: var(--text-muted, #666);
}
.ms-public-room-admin__lead {
  margin: 0 0 0.85rem;
  color: var(--text-muted, #666);
  font-size: 0.9rem;
  line-height: 1.45;
}
.ms-public-room-admin__section + .ms-public-room-admin__section {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.ms-public-room-admin__section-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.ms-public-room-admin__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.ms-public-room-admin__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 0.55rem);
  background: var(--surface);
}
.ms-public-room-admin__row-main {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}
.ms-public-room-admin__row-main strong {
  font-size: 0.92rem;
}
.ms-public-room-admin__row-main small {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.ms-public-room-admin__row-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
}
.ms-public-room-admin__empty {
  margin: 0;
}
.ms-events-admin__lead {
  margin: 0 0 1rem;
  color: var(--text-muted, #666);
  font-size: 0.88rem;
  line-height: 1.45;
}
.ms-events-admin__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.ms-events-admin__list-title,
.ms-events-admin__form-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.ms-events-admin__form-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.ms-events-admin__back {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  line-height: 1;
  font-size: 1rem;
  flex-shrink: 0;
}
.ms-events-admin__back:hover {
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
}
.ms-events-admin__list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ms-events-admin__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 0.65rem;
  text-align: center;
  color: var(--text-muted, #666);
}
.ms-events-admin__empty p {
  margin: 0;
  font-size: 0.85rem;
}
.ms-events-admin__section {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: color-mix(in srgb, var(--surface) 92%, var(--primary, #4f3f73) 8%);
}
.ms-events-admin__section + .ms-events-admin__section,
.ms-events-admin__form + .ms-events-admin__section {
  margin-top: 0.85rem;
}
.ms-events-admin__section--recording {
  margin-top: 1rem;
}
.ms-events-admin__section-title {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #666);
}
.ms-events-admin__form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.25rem;
}
.ms-events-admin__form-actions--single {
  grid-template-columns: 1fr;
}
.ms-events-admin__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}
.ms-events-admin__badge--draft {
  background: color-mix(in srgb, var(--text-muted, #666) 14%, transparent);
  color: var(--text-muted, #666);
}
.ms-events-admin__badge--published {
  background: color-mix(in srgb, #059669 16%, transparent);
  color: #059669;
}
.ms-events-admin__badge--cancelled {
  background: color-mix(in srgb, #dc2626 14%, transparent);
  color: #dc2626;
}
.ms-field__hint {
  font-size: 0.75rem;
  color: var(--text-muted, #666);
  line-height: 1.35;
}

.ms-sidebar-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
}
.ms-sidebar-tabs__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text-muted, #666);
  font-size: 0.8rem;
  font-weight: 600;
}
.ms-sidebar-tabs__btn svg {
  width: 0.95rem;
  height: 0.95rem;
}
.ms-sidebar-tabs__btn.is-active {
  background: var(--accent-soft, rgba(224, 122, 61, 0.12));
  border-color: var(--accent, #e07a3d);
  color: var(--text);
}

.ms-event-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.ms-event-item__content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}
.ms-event-item__thumb {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.55rem;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface);
}
.ms-event-item__thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #666);
}
.ms-event-item__thumb--empty svg {
  width: 1.2rem;
  height: 1.2rem;
}
.ms-event-admin-preview {
  margin-bottom: 0.35rem;
}
.ms-event-admin-preview img {
  width: 100%;
  max-height: 10rem;
  object-fit: cover;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
}
.ms-event-detail__cover {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.ms-event-detail__cover img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
}
.ms-event-item.is-active,
.ms-event-item:hover {
  background: var(--surface-hover, rgba(0, 0, 0, 0.04));
}
.ms-event-item__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}
.ms-event-item__head strong {
  flex: 1;
  font-size: 0.92rem;
}
.ms-event-item__meta,
.ms-event-item__kind {
  font-size: 0.78rem;
  color: var(--text-muted, #666);
}
.ms-event-item__meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ms-event-item__phase.is-live {
  color: #0a7a43;
  font-weight: 600;
}
.ms-event-item__phase.is-cancelled {
  color: #b42318;
}
.ms-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.ms-event-badge--free {
  background: rgba(10, 122, 67, 0.12);
  color: #0a7a43;
}
.ms-event-badge--pro {
  background: rgba(224, 122, 61, 0.12);
  color: var(--accent, #e07a3d);
}

.ms-event-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.ms-event-detail__head {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.ms-event-detail__head h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.15rem;
}
.ms-event-detail__kind {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted, #666);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ms-event-detail__badges {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}
.ms-event-detail__body {
  padding: 1rem 1.1rem 1.5rem;
  overflow: auto;
}
.ms-event-detail__meta {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.ms-event-detail__meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted, #666);
}
.ms-event-detail__meta dd {
  margin: 0;
}
.ms-event-detail__desc {
  margin-bottom: 1rem;
  line-height: 1.55;
}
.ms-event-detail__actions {
  margin-bottom: 1rem;
}
.ms-event-locked,
.ms-event-recording {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  margin-bottom: 1rem;
}
.ms-event-locked p,
.ms-event-recording p {
  margin: 0.35rem 0 0.75rem;
}
.ms-event-recording h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
}
.ms-event-info__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.ms-event-info__meta {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}
.ms-event-info__meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #666);
  margin-bottom: 0.1rem;
}
.ms-event-info__meta dd {
  margin: 0 0 0.65rem;
}
.ms-event-info__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  padding: 0.15rem 0.35rem 0 0;
  color: var(--text);
}
.ms-form-row--two {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 520px) {
  .ms-form-row--stack-sm {
    grid-template-columns: 1fr;
  }
  .ms-events-admin__form-actions {
    grid-template-columns: 1fr;
  }
}
.ms-event-admin-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  margin-bottom: 0;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease;
}
.ms-event-admin-item:hover {
  border-color: color-mix(in srgb, var(--primary, #4f3f73) 35%, var(--border));
}
.ms-event-admin-item.is-active {
  border-color: var(--primary, #4f3f73);
  background: color-mix(in srgb, var(--primary, #4f3f73) 8%, var(--surface));
}
.ms-event-admin-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}
.ms-event-admin-item__head strong {
  font-size: 0.88rem;
  line-height: 1.3;
}
.ms-event-admin-item__meta,
.ms-event-admin-item span.ms-event-admin-item__meta {
  font-size: 0.76rem;
  color: var(--text-muted, #666);
  line-height: 1.35;
}
.ms-grant-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 10rem;
  overflow: auto;
  margin-bottom: 0.35rem;
}
.ms-grant-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
  text-align: left;
}
.ms-grant-result span {
  font-size: 0.78rem;
  color: var(--text-muted, #666);
}
.ms-composer__attach-item.is-pro-locked,
.ms-composer__tool--voice.is-pro-locked {
  position: relative;
}
.ms-composer__attach-item.is-pro-locked::after,
.ms-composer__tool--voice.is-pro-locked::after {
  content: 'Pro';
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.12rem 0.28rem;
  border-radius: 999px;
  background: rgba(224, 122, 61, 0.15);
  color: var(--accent, #e07a3d);
}
