/* Direct conversations and groups: compact reading surfaces, scoped away from the community. */
html body.mm-app.mm-direct #room {
  --thread-chrome:var(--mm-chrome,#f8f9ff);
  --thread-ink:var(--mm-text,#20284b);
  --thread-muted:var(--mm-muted,#607091);
  --thread-edge:var(--mm-line,#dce3f3);
  --thread-soft:var(--mm-soft,#edf1ff);
  --thread-accent:var(--mm-green,#4759c9);
}
html body.mm-app.mm-direct #room>.withdrawal-count {
  padding:2px 0;margin:0 14px 4px;max-width:calc(100% - 28px);
  border:0;border-radius:0;background:transparent;color:var(--thread-muted);
  font-size:10px;font-weight:500;line-height:1.5;
}
html body.mm-app.mm-direct #room .mm-thread-shortcuts {
  gap:6px;padding:6px 12px 9px;scrollbar-width:none;
}
html body.mm-app.mm-direct #room .mm-thread-shortcuts::-webkit-scrollbar {display:none}
html body.mm-app.mm-direct #room .mm-thread-shortcuts>:is(button,a) {
  min-height:34px;padding:7px 10px;border-radius:11px;font-size:11px;
  background:var(--thread-soft);border-color:transparent;
}
html body.mm-app.mm-direct #room .mm-thread-shortcuts>.mm-icon {
  width:34px!important;min-width:34px!important;min-height:34px;height:34px;padding:7px;
}
html body.mm-app.mm-direct #room #messages {padding:16px 14px 20px!important}
html body.mm-app.mm-direct #room #messages>article.direct-bubble {
  display:grid;grid-template-columns:minmax(0,1fr) auto;
  grid-template-areas:"identity identity" "forward forward" "quote quote" "text text" "media media" "reactions time" "extra extra";
  position:relative;gap:0;width:fit-content;min-width:min(170px,100%);max-width:min(88%,580px)!important;
  margin:0 auto 9px 0!important;padding:7px 11px 3px!important;
  border:1px solid var(--mm-line,#e1e6ef);border-radius:20px 20px 20px 7px!important;
  background:var(--mm-bubble,#fff);color:var(--mm-text,#20284b);
  box-shadow:var(--mm-card-shine),0 3px 10px #14234406!important;overflow:visible;
}
html body.mm-app.mm-direct #room #messages>article.direct-bubble.mine {
  margin-left:auto!important;margin-right:0!important;
  border-radius:20px 20px 7px 20px!important;background:var(--mm-mine-fill,var(--mm-mine,#e9e5ff));
}
html body.mm-app.mm-direct #room #messages>article.direct-bubble::before {display:none}
html body.mm-app.mm-direct #room #messages>article.direct-bubble.pb-sender-gutter:not(.mine) {
  margin-left:46px!important;max-width:min(88%,calc(100% - 46px))!important;
  min-width:min(190px,calc(100% - 46px));
}
html body.mm-app.mm-direct #room #messages>article>.pb-message-avatar {
  left:-46px;width:36px!important;min-width:36px;height:36px!important;min-height:36px;
}
/* Names stay interactive. Role chips no longer paint the whole message header. */
html body.mm-app.mm-direct #room #messages>article.direct-bubble>.pb-member-profile {
  grid-area:identity;display:flex;align-items:center;flex-wrap:wrap;gap:2px 6px;
  min-width:0;min-height:30px;margin:0;padding:0 30px 2px 0;
  border:0;border-radius:0;background:transparent;color:var(--thread-accent);
  font-size:11px;line-height:1.35;font-weight:650;
}
html body.mm-app.mm-direct #room #messages .pb-member-status-name {
  order:-1;flex:0 1 auto;min-width:0;min-height:28px;max-width:100%;padding:3px 0;
  border:0;border-radius:4px;background:transparent;color:inherit;
  font:650 12px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  text-align:left;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;
}
html body.mm-app.mm-direct #room #messages .pb-member-profile .mm-role-label {
  display:inline-block;flex:0 1 auto;min-width:0;max-width:100%;padding:2px 5px;
  border:0;border-radius:5px;background:var(--thread-soft);color:var(--thread-muted);
  font-size:10px;line-height:1.3;font-weight:500;overflow-wrap:anywhere;
}
html body.mm-app.mm-direct #room #messages .pb-member-profile .mm-role-label:empty {display:none}
html body.mm-app.mm-direct #room #messages>article.direct-bubble>.mm-bubble-menu {
  position:absolute;inset:2px 2px auto auto;display:grid;place-items:center;
  width:32px;min-width:32px;height:32px;min-height:32px;padding:0;margin:0;
  border:0;border-radius:10px;background:transparent;color:var(--thread-muted);
  opacity:1;font-size:23px;line-height:1;box-shadow:none;
}
html body.mm-app.mm-direct #room #messages>article.direct-bubble>.mm-bubble-menu:hover {background:var(--thread-soft)}
html body.mm-app.mm-direct #room #messages>article.direct-bubble>p {
  grid-area:text;min-width:0;margin:1px 0 4px!important;padding:0;
  white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45!important;
}
html body.mm-app.mm-direct #room #messages>article.direct-bubble>p:empty {display:none}
html body.mm-app.mm-direct #room #messages>article>.mm-forwarded {
  grid-area:forward;margin:0 0 6px;color:var(--thread-muted);font-size:10px;
}
html body.mm-app.mm-direct #room #messages>article>.direct-quote {
  grid-area:quote;min-width:0;margin:3px 0 8px;padding:8px 10px;
  border:0;border-left:3px solid var(--thread-accent);border-radius:8px;
  background:var(--thread-soft);color:var(--thread-muted);font-size:12px;line-height:1.45;
  overflow-wrap:anywhere;
}
html body.mm-app.mm-direct #room #messages>article>.chat-media-slot {
  grid-area:media;min-width:0;max-width:100%;margin:4px 0 6px;
}
html body.mm-app.mm-direct #room #messages>article.direct-bubble>small {
  grid-area:time;display:flex;align-items:center;justify-content:flex-end;gap:4px;
  align-self:end;min-height:18px;margin:0;padding:0 1px 0 8px;
  font-size:10px;line-height:1.2;color:var(--thread-muted);white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
html body.mm-app.mm-direct #room #messages>article>.direct-reactions {
  grid-area:reactions;display:flex;align-items:center;align-self:end;flex-wrap:wrap;
  gap:3px;min-width:0;min-height:32px;margin:0;padding:0;background:transparent;
}
html body.mm-app.mm-direct #room #messages>article>.direct-reactions:empty {display:none}
html body.mm-app.mm-direct #room #messages>article:has(>.direct-reactions:not(:empty))>small {min-height:32px}
html body.mm-app.mm-direct #room #messages>article>.direct-reactions button {
  min-width:32px;min-height:32px;max-width:100%;height:auto;margin:0;padding:4px 7px;
  border:1px solid var(--thread-edge);border-radius:12px;background:var(--thread-soft);
  color:var(--thread-ink);font-size:12px;line-height:1.3;
}
html body.mm-app.mm-direct #room #messages>article>.direct-reactions button.selected {
  border-color:var(--thread-accent);color:var(--thread-accent);
}
html body.mm-app.mm-direct #room #messages>article>.direct-reactions [data-reaction-primary] {
  width:32px;padding:3px;border:0;background:transparent;color:var(--thread-muted);font-size:19px;opacity:1;
}
html body.mm-app.mm-direct #room #messages>article>:is(.mm-star-badge,.mm-edited-badge) {
  grid-area:extra;justify-self:end;margin:0;font-size:10px;
}
html body.mm-app.mm-direct #room #messages .mm-day-separator {
  width:fit-content;margin:3px auto 14px;padding:4px 11px;border-radius:12px;
  background:var(--thread-soft);color:var(--thread-muted);border:0;box-shadow:none;font-size:10px;
}
/* Text, attachments, camera and voice share one row; drafts and recordings keep their own space. */
html body.mm-app.mm-direct #room>.direct-compose {padding:3px 10px 9px;border-top:1px solid var(--thread-edge)}
html body.mm-app.mm-direct #room .cqr-trigger {
  min-height:30px;margin:0 0 2px auto;padding:5px 7px;gap:5px;font-size:11px;color:var(--thread-muted);
}
html body.mm-app.mm-direct #room .cqr-trigger svg {width:15px;height:15px}
html body.mm-app.mm-direct #room #free-form {
  display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:flex-start;gap:4px;
  width:100%;min-width:0;margin:0;padding:0;
}
html body.mm-app.mm-direct #room #free-text {
  order:1;flex:1 1 0%;width:0;min-width:60px;min-height:44px;height:44px;max-height:120px;
  margin:0;padding:10px 12px;border:1px solid var(--thread-edge)!important;border-radius:22px!important;
  background:var(--thread-soft)!important;color:var(--thread-ink)!important;
  font-size:16px;line-height:1.35;box-shadow:none;scrollbar-width:none;
}
html body.mm-app.mm-direct #room #free-form :is(#mm-emoji-button,#media-attach,#mm-camera-shortcut) {
  flex:0 0 36px;width:36px!important;min-width:36px!important;height:44px;min-height:44px;
  padding:7px;margin:0;border:0;background:transparent;color:var(--thread-muted);
}
html body.mm-app.mm-direct #room #mm-emoji-button {order:0;font-size:25px}
html body.mm-app.mm-direct #room #media-attach {order:2}
html body.mm-app.mm-direct #room #mm-camera-shortcut {order:3}
html body.mm-app.mm-direct #room #free-form :is(#free-send,#media-record) {
  order:4;flex:0 0 44px;width:44px;min-width:44px;min-height:44px;height:44px;margin:0;padding:10px;
  border:0;border-radius:50%;background:var(--wcpa-action,#4168e5);color:var(--wcpa-action-ink,#fff);
}
html body.mm-app.mm-direct #room #free-form #media-record.recording {background:#c65745!important;color:#fff}
html body.mm-app.mm-direct #room #free-form>.media-draft {order:-2;flex:1 0 100%}
html body.mm-app.mm-direct #room #free-form>.media-voice {order:1;flex:1 1 100%;min-width:0}
html body.mm-app.mm-direct #room #free-form.media-is-recording :is(#mm-emoji-button,#mm-camera-shortcut) {display:none}
html body.mm-app.mm-direct #room :is(.mm-bubble-menu,.pb-member-status-name,#free-text):focus-visible {
  outline:2px solid var(--thread-accent);outline-offset:2px;
}
@media(max-width:760px) {
  html body.mm-app.mm-direct #room .mm-chat-header {min-height:60px;padding-top:calc(6px + env(safe-area-inset-top,0px));padding-bottom:6px;gap:2px}
  html body.mm-app.mm-direct #room #messages {padding:12px 12px 16px!important}
  html body.mm-app.mm-direct.mm-room-open .mm-shell>.mm-bottom-nav {min-height:56px;padding:4px;margin-top:3px}
  html body.mm-app.mm-direct.mm-room-open .mm-shell>.mm-bottom-nav>:is(button,a) {flex:1 1 0;min-width:0;min-height:44px;padding-block:4px!important;gap:3px}
  html body.mm-app.mm-direct.mm-room-open .mm-bottom-nav>:is(button,a)>span {white-space:nowrap}
}
@media(max-width:359px) {
  html body.mm-app.mm-direct.mm-room-open .mm-bottom-nav>:is(button,a)>span {font-size:9px!important;letter-spacing:-.1px}
  html body.mm-app.mm-direct #room>.direct-compose {padding-inline:6px}
  html body.mm-app.mm-direct #room #free-form {gap:2px}
  html body.mm-app.mm-direct #room #free-form :is(#mm-emoji-button,#media-attach,#mm-camera-shortcut) {flex-basis:32px;width:32px!important;min-width:32px!important;padding:5px}
  html body.mm-app.mm-direct #room #free-text {padding-inline:10px}
}
@media(forced-colors:active) {
  html body.mm-app.mm-direct #room #messages>article.direct-bubble {border:1px solid CanvasText;background:Canvas;color:CanvasText}
  html body.mm-app.mm-direct #room #messages .pb-member-profile .mm-role-label {color:CanvasText}
}

/* Voice notes use their natural content height and share the attachment controls. */
html body.mm-app.mm-direct #room #messages>article.direct-bubble.pb-voice-message{min-height:0;width:334px;max-width:min(92%,580px)!important;padding:7px 10px 2px!important;row-gap:0}
html body.mm-app.mm-direct #room #messages>article.direct-bubble.pb-voice-message>.chat-media-slot{width:100%;margin:0 0 2px}
html body.mm-app.mm-direct #room #messages>article.direct-bubble.pb-voice-message>.pb-member-profile{min-height:28px;padding-bottom:0;font-size:13px}
html body.mm-app.mm-direct #room #messages>article.direct-bubble.pb-voice-message>.direct-reactions{min-height:32px}
html body.mm-app.mm-direct #room #messages>article.direct-bubble.pb-voice-message>small{font-size:12px}
html body.mm-app.mm-direct #room #media-status:empty{display:none}
html body.mm-app.mm-direct #room .mm-thread-shortcuts>:is(button,a){min-height:44px;padding:8px 12px;font-size:14px}
html body.mm-app.mm-direct #room .mm-thread-shortcuts>.mm-icon{width:44px!important;min-width:44px!important;min-height:44px;height:44px;padding:10px}
html body.mm-app.mm-community #media-status:empty{display:none}
