:root{
  --bg:#f7f8fc;
  --panel:#ffffff;
  --outline:#e7e8f3;
  --shadow:0 10px 24px rgba(99,102,241,.15);
  --ink:#0f172a;
  --ink-sub:#475569;
  --brand:#6366f1;
  --brand-ink:#ffffff;
  --me:#3b82f6;
  --them:#eef2ff;
}

*{box-sizing:border-box}
html,body{height:100%}
body{margin:0; background:var(--bg); color:var(--ink); font:16px/1.5 system-ui,Segoe UI,Roboto,Arial}

/* Layout shell */
.chat{
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  height: 100vh;
  padding: 18px;

  /* New: center the whole grid and prevent it from feeling “off” */
  max-width: 1120px;
  margin: 0 auto;
}

.chat .sidebar{
  background:var(--panel); border:1px solid var(--outline); border-radius:16px; box-shadow:var(--shadow);
  display:flex; flex-direction:column; overflow:hidden; min-width:240px;
}
.chat .main{
  background:var(--panel); border:1px solid var(--outline); border-radius:16px; box-shadow:var(--shadow);
  display:flex; flex-direction:column; overflow:hidden;
}

/* Sidebar */
.rooms-header{
  display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--outline);
}
.rooms-title{ font-weight:800; letter-spacing:.2px; }
.rooms{
  padding:10px; overflow:auto; flex:1;
}
.room{
  -webkit-tap-highlight-color: transparent;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px; border-radius:12px; border:1px solid transparent; cursor:pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.room:hover{ background:#f8f9ff; border-color:#edf0ff; }
.room--active{ background:#eef2ff; border-color:#dfe4ff; color:#3730a3; }
.room .count{
  min-width:22px; height:22px; padding:0 6px; border-radius:999px;
  background:#eef2ff; color:#3730a3; display:inline-flex; align-items:center; justify-content:center; font-weight:700;
}

/* Main header */
.header{
  display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--outline);
}
.header .left{display:flex; align-items:center; gap:10px;}
.header .title{ font-weight:800; letter-spacing:.2px; font-size:1.05rem; }
.header .subtitle{ color:var(--ink-sub); font-size:.9rem;}

/* Message list */
.messages{
  flex:1; overflow:auto; padding:16px 12px; background:
  radial-gradient(1000px 60px at 50% -30px, rgba(99,102,241,.06), transparent),
  linear-gradient(#ffffff, #ffffff);
}
.msg{
  display:grid; grid-template-columns: 40px 1fr; gap:10px; margin:12px 0; max-width: 640px;
}
.msg--me{ margin-left:auto; grid-template-columns: 1fr 40px; }
.msg--me .avatar{ order:2; }
.msg--me .bubble{ background:rgba(59,130,246,.08); border-color: rgba(59,130,246,.25); }
.msg--deleted .bubble{ opacity:.65; filter:saturate(.6); font-style:italic; }
.msg--shadowbanned .bubble{ opacity:.75; }

.avatar{
  width:36px; height:36px; border-radius:50%; background:#e2e8f0; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--outline); font-weight:800; color:#334155;
}
.avatar.admin{ background:#111827; color:#fff; border-color:#0b1220; }
.avatar .badge{ position:absolute; transform: translate(18px,-4px); font-size:12px; }

.bubble{
  background:#fff; border:1px solid var(--outline); border-radius:14px; padding:10px 12px; box-shadow: 0 1px 0 rgba(16,24,40,.04);
}
.meta{
  display:flex; align-items:center; gap:10px; margin:0 0 6px;
  color:#64748b; font-size:.85rem;
}
.meta .name{ font-weight:700; color:#0f172a; }
.meta .role{ font-weight:700; color:#111827; background:#e5e7eb; border:1px solid #e5e7eb; border-radius:999px; padding:2px 8px; }
.meta .role--admin{ background:#0b1220; color:#fff; }
.meta .time{ margin-left:auto; font-variant-numeric: tabular-nums; opacity:.8; }

/* Badges for bans */
.badge-hard{ display:inline-flex; align-items:center; gap:4px; padding:2px 6px; border-radius:999px; background:#fee2e2; color:#b91c1c; border:1px solid #fecaca; }
.badge-soft{ display:inline-flex; align-items:center; gap:4px; padding:2px 6px; border-radius:999px; background:#e0e7ff; color:#3730a3; border:1px solid #c7d2fe; }

/* Presence list + typing */
.presence{
  padding:8px 12px; border-top:1px solid var(--outline); background: linear-gradient(#fff,#fff);
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
}
.presence .user{ display:inline-flex; align-items:center; gap:6px; border:1px solid var(--outline); padding:4px 8px; border-radius:999px; }
.presence .dot{ width:8px; height:8px; border-radius:50%; background:#10b981; box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
.presence .user .name{ font-weight:600; }
.presence .typing{ font-style:italic; color:#64748b; }

/* Header meta */
.chat-meta{
  display:flex; gap:16px; align-items:center;
  font-size:.95rem; color:var(--ink-sub);
  padding:6px 0 2px;
}
.online-list{ white-space:nowrap; }
.typing-indicator{ opacity:.9; font-style:italic; }

/* Room tabs */
.tab{
  -webkit-tap-highlight-color: transparent;
  display:inline-flex; align-items:center; justify-content:center;
  height:36px; padding:0 12px; margin-right:6px;
  border-radius:10px; border:1px solid var(--outline);
  background:#fff; color:var(--ink-sub); cursor:pointer;
  transition:background .2s ease, color .2s ease, border-color .2s ease, transform .05s ease;
}
.tab:hover{ background:#f8fafc; color:#0f172a; }
.tab--active{ background:#eef2ff; color:#3730a3; border-color:#dfe4ff; font-weight:700; }

/* Inline flags */
.flag{
  display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:999px;
  border:1px solid var(--outline); color:#0f172a; background:#fff; font-weight:600;
}

/* Message content */
.text{ white-space:pre-wrap; word-break:break-word; }
.text code{
  background:#f8fafc; border:1px solid #e2e8f0; border-radius:6px; padding:0 4px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Message menu button (legacy prompt menu; safe to leave for now) */
.msg .msg-menu{
  margin-left:8px; border:0; background:transparent; color:#64748b;
  cursor:pointer; font-size:16px; line-height:1; padding:2px 6px; border-radius:8px;
  transition: background .15s ease, color .15s ease;
}
.msg .msg-menu:hover{ background:rgba(0,0,0,.06); color:#111827; }

/* Presence bar (upgraded) */
.presence-prefix{ color:var(--ink-sub); margin-right:6px; }
.presence-item{ display:inline-flex; align-items:center; gap:6px; margin-right:10px; padding:3px 8px; border-radius:999px; border:1px solid var(--outline); }
.presence-dot{
  position:relative; width:8px; height:8px; border-radius:999px; background:#10b981; box-shadow:0 0 0 0 rgba(16,185,129,.6);
}
.presence-dot::before{
  content:""; position:absolute; inset:0; border-radius:999px; box-shadow:0 0 0 0 rgba(16,185,129,.5); animation: presencePulse 1.6s ease-out infinite;
}
.presence-dot::after{
  content:""; position:absolute; inset:0; border-radius:999px; box-shadow:0 0 0 0 rgba(16,185,129,.35); animation: presenceWave 1.6s ease-out infinite;
}

@keyframes presencePulse{
  0%{ transform: scale(.75); opacity:.75; }
  70%{ transform: scale(1.25); opacity:0; }
  100%{ transform: scale(1.25); opacity:0; }
}
@keyframes presenceWave{
  0%{ transform: scale(.75); opacity:.3; }
  60%{ transform: scale(1.35); opacity:.08; }
  100%{ transform: scale(1.35); opacity:.05; }
}

/* Composer */
.composer{
  display:flex; gap:10px; padding:10px; border-top:1px solid var(--outline); background:#fff;
}
#messageInput{
  flex:1; min-height:42px; max-height:140px; resize:vertical; padding:10px 12px;
  border:1px solid var(--outline); border-radius:12px; background:#fff; color:inherit;
  font:inherit; box-shadow: inset 0 1px 2px rgba(16,24,40,.04);
}
#sendBtn{ height:42px; min-width:80px; font-weight:700; color:#fff; background:var(--brand);
  border:0; border-radius:12px; cursor:pointer; transition: transform .04s ease, filter .15s ease; }
#sendBtn:hover{ filter: brightness(1.02); }
#sendBtn:active{ transform: translateY(1px); }

/* Admin-only shadow-ban state */
.msg--shadowbanned .text{ opacity:.7; font-style:italic; }

/* Small screens */
@media (max-width: 640px){
  .msg{ max-width: 88%; }
}

/* =========================================================
   HB-6B — Moderation Popover & Actions Trigger (Aug 27, 2025)
   ========================================================= */

.mtm-popover-overlay{
  position:fixed; inset:0; background:transparent; z-index: 9998;
}

.mtm-popover{
  position:absolute;
  background: var(--panel, #fff);
  color: var(--ink, #0f172a);
  border: 1px solid var(--outline, #e7e8f3);
  border-radius: 14px;
  box-shadow: var(--shadow, 0 10px 24px rgba(16,24,40,.16));
  padding: 8px;
  min-width: 220px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-4px);
  animation: mtmPopoverIn .12s ease-out forwards;
}

.mtm-popover[data-placement="below"]{ transform: translateY(4px); }
.mtm-popover[data-placement="below"].is-open,
.mtm-popover.is-open{ opacity:1; transform: translateY(0); }

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

.mtm-popover__caret{
  position:absolute; width: 12px; height: 12px; background: var(--panel,#fff);
  border-left:1px solid var(--outline,#e7e8f3); border-top:1px solid var(--outline,#e7e8f3);
  transform: rotate(45deg); pointer-events:none;
}
.mtm-popover[data-placement="below"] .mtm-popover__caret{
  top: -6px; right: 16px;
}
.mtm-popover[data-placement="above"] .mtm-popover__caret{
  bottom: -6px; right: 16px; transform: rotate(225deg);
}

.mtm-popover__list{ display:flex; flex-direction:column; gap:4px; }

.mtm-popover__sep{
  height:1px; background: var(--outline, #e7e8f3); margin:4px 6px;
}

.mtm-popover__item{
  display:flex; align-items:center; gap:10px;
  width:100%; border:0; background:transparent; color:inherit; text-align:left;
  padding:10px 12px; border-radius:10px; cursor:pointer;
  font: 500 14px/1.2 system-ui,Segoe UI,Roboto,Arial;
  transition: background .12s ease, color .12s ease, transform .02s ease;
}
.mtm-popover__item .mtm-popover__icon{ width:1.25em; text-align:center; opacity:.9; }
.mtm-popover__item .mtm-popover__label{ flex:1; }
.mtm-popover__item .mtm-popover__shortcut{
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  opacity:.6; background: rgba(99,102,241,.08); border:1px solid rgba(99,102,241,.25);
  padding:2px 6px; border-radius:6px;
}
.mtm-popover__item:hover,
.mtm-popover__item:focus-visible{
  outline: none;
  background: rgba(99,102,241,.10);
}
.mtm-popover__item.is-danger:hover,
.mtm-popover__item.is-danger:focus-visible{
  background: rgba(239,68,68,.12);
  color: #b91c1c;
}
.mtm-popover__item.is-disabled,
.mtm-popover__item[disabled]{
  opacity:.6; cursor: not-allowed;
}

/* Actions trigger on each message (replaces prompt-based menu) */
.mtm-action-trigger{
  -webkit-tap-highlight-color: transparent;
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; margin-left:6px;
  border:0; border-radius:8px; background:transparent; color:#64748b;
  cursor:pointer; line-height:1; font-size:16px;
  transition: background .12s ease, color .12s ease, transform .02s ease, box-shadow .12s ease;
}
.mtm-action-trigger:hover{ background: rgba(0,0,0,.06); color:#111827; }
.mtm-action-trigger:focus-visible{
  outline: 0;
  box-shadow: 0 0 0 2px rgba(99,102,241,.25), 0 0 0 4px rgba(99,102,241,.15);
}
.mtm-action-trigger:active{ transform: translateY(1px); }
.mtm-action-trigger .dots{
  display:inline-block; letter-spacing:1px; font-weight:700;
}

/* Compact message header alignment for the trigger */
.msg .meta{ display:flex; align-items:center; gap:6px; }
.msg .meta .right-tools{ margin-left:auto; display:inline-flex; align-items:center; }

/* Utility: Screen-reader-only text */
.mtm-sr-only{
  position:absolute !important; width:1px !important; height:1px !important;
  padding:0 !important; margin:-1px !important; overflow:hidden !important; clip:rect(0,0,0,0) !important;
  white-space:nowrap !important; border:0 !important;
}

/* Z-index guard: ensure popover floats above chat composer & header */
.chat, .chat *{ z-index: initial; }

/* --- Hotfix: make message layout single-column to match current DOM --- 
.messages .msg{
  display:block;
  max-width:640px;
  margin:12px 0;
  word-wrap:break-word;
}
.messages .msg.me{ margin-left:auto; }

.messages .msg .meta{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0 0 6px;
  color:#64748b;
  font-size:.9rem;
}

.messages .msg .text{
  background:#fff;
  border:1px solid var(--outline);
  border-radius:14px;
  padding:10px 12px;
  line-height:1.4;
  word-break:break-word;
}

.messages .msg .text--deleted{
  opacity:.65;
  font-style:italic;
}

/* keep popover above composer just in case 
.chat, .chat *{ z-index: initial; } */


/* ===== MTM Chat — Message Window Polish v1 ===== */
.chat {
  --bg: #f7f9fc;
  --bubble: #ffffff;
  --mine: #eaf1ff;
  --text: #1f2937;
  --subtle: #6b7280;
  --accent: #6c63ff;
  --outline: rgba(15, 23, 42, 0.08);
}

/* Container & list */
.messages {
  background: var(--bg);
  border-radius: 16px;
  padding: 16px 12px;
  overflow: auto;
  /* subtle inner border to lift the list off the page */
  box-shadow: inset 0 0 0 1px var(--outline);
}

/* Each message row */
.msg {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px 12px;
  align-items: flex-start;
  margin: 8px 0;
}

/* Avatar polish */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #eef2f7;
  color: #111;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

/* Bubble */
.bubble {
  max-width: 700px;
  background: var(--bubble);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 1px 3px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--outline);
}

/* My messages right-aligned with accent bubble */
.msg--me {
  grid-template-columns: 1fr 40px; /* flip columns */
}
.msg.msg--me .bubble {
  background: var(--mine);
  border-color: rgba(108, 99, 255, 0.12);
}
.msg.msg--me .avatar {
  background: #111;
  color: #fff;
}

/* Meta row (name/time) */
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.meta .name {
  font-weight: 700;
  color: var(--text);
}
.meta .time {
  margin-left: auto;
  font-size: 12px;
  color: var(--subtle);
}
.mod-tag,
.ban-tag {
  margin-left: 4px;
  font-size: 12px;
}

/* Message text */
.text {
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}
.text--deleted {
  opacity: .7;
  font-style: italic;
}

/* Action menu button (•••) */
.mtm-action-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
}
.mtm-action-trigger:hover {
  background: rgba(15, 23, 42, 0.06);
}

/* Composer stays visible and clean */
#composer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--outline);
  padding-top: 10px;
}

/* Input polish */
#msgInput {
  border-radius: 12px;
  border: 1px solid var(--outline);
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
#msgInput:focus {
  outline: none;
  border-color: rgba(108,99,255,0.35);
  box-shadow:
    0 0 0 3px rgba(108, 99, 255, 0.12),
    0 1px 0 rgba(255,255,255,.8) inset;
}

/* Send button */
#sendBtn {
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

/* Scrollbar (Chrome/Edge/Safari) */
.messages::-webkit-scrollbar { height: 10px; width: 10px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.16);
  border-radius: 10px;
}
.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,0.28);
}

/* Popover polish */
.mtm-popover {
  border-radius: 12px;
  border: 1px solid var(--outline);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.mtm-popover__item {
  border-radius: 10px;
}
.mtm-popover__item.is-danger {
  color: #b91c1c;
}


/* ===== MTM Chat — Composer Bar ===== */

/* Stick to bottom of the messages panel */
#composer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--outline);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5; /* keep above scroll content */
}

/* Make the input a one-line pill bar (not resizable) */
#msgInput {
  flex: 1 1 auto;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  resize: none;            /* <- no draggable resize */
  overflow-y: hidden;      /* keep it one line visually */
  border-radius: 999px;    /* pill */
  padding: 10px 14px;
  border: 1px solid var(--outline);
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
  line-height: 22px;
  white-space: nowrap;     /* keep bar feel; long text scrolls */
  overflow-x: auto;
}

#msgInput:focus {
  outline: none;
  border-color: rgba(108,99,255,0.35);
  box-shadow:
    0 0 0 3px rgba(108, 99, 255, 0.12),
    0 1px 0 rgba(255,255,255,.8) inset;
}

/* Send button matches bar height */
#sendBtn {
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}


/* ==== MTM Chat — Beauty Pack v2 ========================================= */
.chat {
  --bg: #f6f8fb;
  --panel: #f9fbff;
  --bubble: #ffffff;
  --mine: #eaf1ff;
  --text: #1f2937;
  --subtle: #6b7280;
  --accent: #6c63ff;
  --accent-2: #8a84ff;
  --outline: rgba(15, 23, 42, 0.08);
}

/* Panel gets a soft gradient + lifted edges */
.messages {
  background: linear-gradient(180deg, #f9fbff 0%, #f6f8fb 100%);
  border-radius: 18px;
  padding: 18px 14px;
  box-shadow:
    inset 0 0 0 1px var(--outline),
    0 12px 30px rgba(15,23,42,0.06);
}

/* Tabs glow a bit on active */
#roomTabs [data-room] {
  border-radius: 10px;
  transition: background .2s, color .2s, box-shadow .2s;
}
#roomTabs .tab--active {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(108, 99, 255, .35);
}

/* Message row spacing + entry animation */
.msg {
  margin: 10px 0;
  animation: msgIn .17s ease-out both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px) scale(.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bubble polish + subtle hover */
.bubble {
  background: var(--bubble);
  border-radius: 18px;
  padding: 12px 16px;
  border: 1px solid var(--outline);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 2px 10px rgba(15,23,42,0.06);
  transition: transform .05s ease, box-shadow .15s ease, border-color .15s ease;
}
.bubble:hover {
  transform: translateY(-1px);
  border-color: rgba(108,99,255,0.18);
  box-shadow: 0 4px 18px rgba(15,23,42,0.10);
}

/* “Tail” accents */
.msg .bubble::after,
.msg.msg--me .bubble::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  background: inherit;
  border: 1px solid var(--outline);
  border-left: none; border-top: none;
  transform: rotate(45deg);
  bottom: -5px;
}
.msg .bubble::after { left: 46px; }
.msg.msg--me .bubble::after {
  right: 46px;
  border-color: rgba(108,99,255,0.18);
}

/* Mine: gentle blue + stronger text */
.msg.msg--me .bubble {
  background: var(--mine);
  border-color: rgba(108,99,255,0.18);
}
.msg.msg--me .name { color: #111827; }

/* Avatar badges – crisper */
.avatar {
  border-radius: 12px;
  background: #eef2f7;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

/* Meta & timestamps */
.meta { margin-bottom: 6px; }
.meta .name { font-weight: 700; color: var(--text); }
.meta .time { color: var(--subtle); letter-spacing: .01em; }

/* Deleted look */
.text--deleted {
  opacity: .75;
  font-style: italic;
  color: #6b7280;
}

/* Composer bar refinement */
#composer {
  padding: 14px 14px 16px;
  background: linear-gradient(180deg, #fff, #f6f7fb);
  border-top: 1px solid var(--outline);
}
#msgInput {
  border: 1px solid var(--outline);
  background: #fff;
}
#msgInput::placeholder { color: #9aa3af; }
#sendBtn {
  font-weight: 700;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  border: none;
  color: #fff;
  transition: transform .06s ease, box-shadow .2s ease;
}
#sendBtn:hover { box-shadow: 0 8px 18px rgba(108,99,255,.36); }
#sendBtn:active { transform: translateY(1px); }

/* Popover glow + nicer items */
.mtm-popover {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--outline);
  box-shadow: 0 18px 38px rgba(15,23,42,.22);
}
.mtm-popover__item { transition: background .15s ease, color .15s ease; }
.mtm-popover__item:hover { background: rgba(108,99,255, .08); }
.mtm-popover__item.is-danger:hover { background: rgba(185,28,28, .12); }

/* Mobile tweaks */
@media (max-width: 680px) {
  .messages { padding: 12px 10px; border-radius: 14px; }
  .bubble { padding: 10px 12px; border-radius: 14px; }
  #composer { padding: 10px; }
  #msgInput, #sendBtn { height: 40px; }
}


/* HB-6: Typing banner smoothing */
#typingIndicator {
  min-height: 1.2em;            /* reserve space to prevent layout jump */
  opacity: 0;
  transition: opacity .2s ease;
}
#typingIndicator.is-visible {
  opacity: 1;
  animation: mtm-typing-pulse 1.5s ease-in-out infinite;
}
@keyframes mtm-typing-pulse {
  0%   { opacity: .5; }
  50%  { opacity: 1; }
  100% { opacity: .5; }
}

/* Mobile layout: stack sidebar + messages and keep things comfy */
@media (max-width: 768px) {
  .chat {
    grid-template-columns: 1fr;   /* single column */
    height: auto;                 /* let page scroll naturally */
    padding: 12px 10px 16px;
  }

  .chat .main {
    order: 1;                     /* messages on top */
  }

  .chat .sidebar {
    order: 2;                     /* rooms/presence below */
    min-width: 0;                 /* allow it to shrink */
  }
}

