/* Final experience layer: consistent type and controls over the existing Connect layout.
   Appearance/palette tokens remain authoritative. Message and player geometry stay owned
   by connect-conversation.css and voice-player.css. */
html body.mm-app[data-mm-theme] {
  --experience-accent:var(--mm-green,#5145cd);
  --experience-action:var(--wcpa-action,#5844db);
  --experience-action-fill:var(--mm-action-fill,var(--wcpa-action,#5844db));
  --experience-action-ink:var(--wcpa-action-ink,#fff);
  font-size:16px;
}

/* The contact, actions and optional shortcuts each keep a clear place in the header. */
html body.mm-app.mm-direct[data-mm-theme] #room {
  --thread-chrome:var(--mm-chrome,#fff);--thread-ink:var(--mm-text,#20223e);
  --thread-muted:var(--mm-muted,#5b5d77);--thread-edge:var(--mm-line,#e3e5f1);
  --thread-soft:var(--mm-soft,#eef0fc);--thread-accent:var(--mm-green,#5145cd);
}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header {
  min-height:72px;padding:10px 16px;gap:7px;
  background:var(--mm-ambient),var(--glass-sheen),var(--glass-fill,var(--mm-chrome))!important;
  border-bottom:1px solid var(--glass-edge,var(--mm-line));
  box-shadow:inset 0 1px 0 var(--glass-highlight,#ffffff60),0 4px 14px #23376108;
}
html body.mm-app.mm-direct[data-mm-theme] #room #room-title {
  font-size:17px;line-height:1.35;font-weight:650;letter-spacing:-.25px;
  color:var(--mm-text);
}
html body.mm-app.mm-direct[data-mm-theme] #room :is(#mm-last-seen,.direct-private) {
  margin-top:2px;font-size:12px;line-height:1.4;color:var(--mm-muted);
}
html body.mm-app.mm-direct[data-mm-theme] #room #unavailable {font-size:14px;line-height:1.45}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header>#mm-room-avatar {
  flex-basis:42px;width:42px;height:42px;border:1px solid var(--glass-edge,var(--mm-line));
  background:var(--mm-soft);color:var(--experience-accent);
}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header :is(.mm-icon,[data-call-start]) {
  color:var(--experience-accent);border-radius:14px;
}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts {
  padding:4px 12px;gap:5px;background:var(--mm-chrome);
  border-color:var(--mm-line);scroll-padding-inline:12px;scrollbar-width:thin;
  scrollbar-color:var(--mm-line) transparent;scroll-snap-type:x proximity;
}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts>:is(button,a) {
  min-height:44px;padding:9px 12px;border-radius:14px;border:1px solid transparent;
  background:transparent;color:var(--mm-muted);font-size:14px;font-weight:550;
  line-height:1.4;scroll-snap-align:start;
}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts>.mm-icon {
  width:44px!important;min-width:44px!important;height:44px;min-height:44px;
  padding:10px;background:transparent;color:var(--experience-accent);border-color:transparent;
}
html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts :is([aria-pressed=true],[aria-expanded=true]) {
  border-color:var(--experience-accent);background:var(--mm-soft);color:var(--experience-accent);
}
html body.mm-app.mm-direct[data-mm-theme] #room #conversation-action-status {
  font-size:14px;line-height:1.45;padding:7px 14px;
}
/* Keep personal notices readable without turning them into another large card. */
html body.mm-app.mm-direct[data-mm-theme] #room #pinned {
  margin:5px 12px 7px;border-color:var(--mm-line)!important;
  background:var(--mm-soft)!important;color:var(--mm-text)!important;border-radius:14px;
  box-shadow:none;
}
html body.mm-app.mm-direct[data-mm-theme] #room #pinned .pin-compact {
  min-height:52px;padding:8px 11px;gap:10px;
}
html body.mm-app.mm-direct[data-mm-theme] #room #pinned .pin-compact strong {
  font-size:14px;line-height:1.4;font-weight:600;color:var(--mm-text)!important;
}
html body.mm-app.mm-direct[data-mm-theme] #room #pinned .pin-compact-excerpt {
  font-size:14px;line-height:1.4;color:var(--mm-muted)!important;
}
html body.mm-app.mm-direct[data-mm-theme] #room #pinned :is(.pin-compact-icon,.pin-compact-more) {
  color:var(--experience-accent);font-size:14px;
}

/* Search, filters and rows share the same type scale and selection language. */
html body.mm-app[data-mm-theme] .mm-list-pane .mm-search:focus-within {
  border-color:var(--experience-accent);outline:2px solid var(--experience-accent);outline-offset:2px;
}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-search input {font-size:16px}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-area-compact>a,
html body.mm-app[data-mm-theme] .mm-list-pane .connect-area-more>summary {
  font-size:14px;font-weight:550;line-height:1.3;min-height:48px;
}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-filters {gap:6px;scroll-padding-inline:2px}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-filters>button {
  min-height:44px;padding:10px 14px;border-radius:14px;
  font-size:14px;line-height:1.35;color:var(--mm-muted);
}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-filters>button[aria-pressed=true] {
  color:var(--experience-action-ink);background:var(--experience-action-fill);
  border-color:transparent;font-weight:650;box-shadow:inset 0 1px 0 #ffffff24;
}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-filters>button[aria-pressed=true] .connect-filter-count {color:inherit}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-row-copy>strong {font-size:16px;line-height:1.4}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-row-copy>small {font-size:14px;line-height:1.45}
html body.mm-app[data-mm-theme] .mm-list-pane .mm-row-meta {font-size:12px;font-variant-numeric:tabular-nums}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests {border-radius:17px}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-request-copy strong {font-size:16px;line-height:1.35;letter-spacing:-.15px}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-request-copy small {font-size:14px;line-height:1.4}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests[data-has-requests=true] {
  background:var(--mm-ambient),var(--mm-surface);border-color:var(--glass-edge);
  box-shadow:var(--mm-card-shine),var(--mm-card-shadow);
}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests[data-has-requests=false] {
  min-height:44px;padding:5px 8px;border-color:transparent;background:transparent;box-shadow:none;
}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests[data-has-requests=false] .connect-request-copy small {display:none}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests[data-has-requests=false] .connect-request-icon {width:30px;height:30px;flex-basis:30px;border-radius:11px;background:var(--mm-soft);color:var(--experience-accent)}
html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests[data-has-requests=false] .connect-request-copy strong {font-size:14px;font-weight:550}
/* Color is concentrated in creation and sending; reading surfaces stay calm. */
html body.mm-app[data-mm-theme] .mm-list-pane .wcpa-header-actions #mm-new-chat,
html body.mm-app.mm-direct[data-mm-theme] #room #free-form :is(#free-send,#media-record:not(.recording)) {
  background:var(--experience-action-fill)!important;color:var(--experience-action-ink)!important;
  box-shadow:inset 0 1px 0 #ffffff24,0 3px 9px #31298416;
}

/* Conversation text gets a readable desktop size as well as a readable phone size. */
html body.mm-app.mm-direct[data-mm-theme] #room #messages>article.direct-bubble>p,
html body.mm-app.mm-direct[data-mm-theme] #room #messages .mm-rich-text {
  font-size:16px;line-height:1.5!important;
}
html body.mm-app.mm-direct[data-mm-theme] #room #messages>article.direct-bubble:not(.pb-voice-message) .pb-member-status-name {
  font-size:14px;line-height:1.4;
}
html body.mm-app.mm-direct[data-mm-theme] #room #messages>article.direct-bubble:not(.pb-voice-message)>small {font-size:12px}
html body.mm-app.mm-direct[data-mm-theme] #room #messages>article>.direct-quote {font-size:14px;line-height:1.45}
html body.mm-app.mm-direct[data-mm-theme] #room #messages .mm-day-separator {
  font-size:12px;line-height:1.4;font-weight:550;
}
html body.mm-app.mm-direct[data-mm-theme] #room #messages>article.direct-bubble>p a {
  color:var(--experience-accent);text-decoration:underline;text-underline-offset:3px;
}

/* The composer keeps one primary action and quiet secondary controls. */
html body.mm-app.mm-direct[data-mm-theme] #room>.direct-compose {
  padding:7px 10px max(8px,env(safe-area-inset-bottom,0px));border-color:transparent;background:var(--mm-chrome)!important;
  box-shadow:0 -5px 20px #22335306;
}
html body.mm-app.mm-direct[data-mm-theme] #room #free-form {
  padding:5px;gap:2px;border:1px solid var(--glass-edge);border-radius:28px;
  background:var(--glass-sheen),var(--mm-surface);box-shadow:var(--mm-card-shine),var(--mm-card-shadow);
}
html body.mm-app.mm-direct[data-mm-theme] #room .cqr-trigger {
  min-height:38px;padding:7px 9px;margin-bottom:2px;font-size:14px;font-weight:500;
  color:var(--mm-muted);border-radius:11px;line-height:1.4;
}
html body.mm-app.mm-direct[data-mm-theme] #room .cqr-trigger svg {width:18px;height:18px}
html body.mm-app.mm-direct[data-mm-theme] #room #free-text {
  font-size:16px;line-height:1.4;background:transparent!important;
  color:var(--mm-text)!important;border-color:transparent!important;
}
html body.mm-app.mm-direct[data-mm-theme] #room #free-text::placeholder {color:var(--mm-muted);opacity:1}
html body.mm-app.mm-direct[data-mm-theme] #room #free-text:focus-visible {
  border-color:var(--experience-accent)!important;outline:2px solid var(--experience-accent);outline-offset:1px;
}
html body.mm-app.mm-direct[data-mm-theme] #room #free-form :is(#mm-emoji-button,#media-attach,#mm-camera-shortcut) {
  color:var(--mm-muted);border-radius:14px;
}
html body.mm-app.mm-direct[data-mm-theme] #room .direct-reply {
  border-left:3px solid var(--experience-accent);border-radius:12px;
  background:var(--mm-soft);color:var(--mm-text);font-size:14px;line-height:1.5;
}
html body.mm-app.mm-direct[data-mm-theme] #room #clear-reply {
  flex:0 0 44px;min-width:44px;min-height:44px;border:0;background:transparent;
  color:var(--mm-muted);font-size:22px;border-radius:12px;
}

/* Larger navigation labels stay within their five existing destinations. */
html body.mm-app[data-mm-theme] .mm-shell>.mm-bottom-nav>:is(button,a)>span:not(.connect-nav-unread),
html body.mm-app.mm-direct[data-mm-theme] .mm-shell>.mm-bottom-nav>:is(button,a)>span:not(.connect-nav-unread) {
  font-size:14px!important;line-height:1.25;letter-spacing:-.2px;
}
html body.mm-app[data-mm-theme] .mm-bottom-nav>a[data-connect-destination="/marketplace"]>span {
  margin-inline:-7px;max-width:calc(100% + 14px);letter-spacing:-.45px;
}
html body.mm-app[data-mm-theme] .mm-shell>.mm-bottom-nav .connect-nav-unread {font-size:12px}

/* Notifications inside Connect share the inbox's reading rhythm and avatars. */
html body.mm-app[data-mm-theme] #mm-notifications .mm-notification-row {
  align-items:center;gap:12px;padding:14px;min-height:76px;margin:8px 12px;border:1px solid var(--glass-edge);border-radius:22px;
  background:var(--mm-surface);color:var(--mm-text);box-shadow:var(--mm-card-shine),var(--mm-card-shadow);
}
html body.mm-app[data-mm-theme] #mm-notifications .mm-notification-avatar {
  flex:0 0 52px;width:52px;height:52px;border-radius:50%;
  background:var(--mm-soft);color:var(--experience-accent);
}
html body.mm-app[data-mm-theme] #mm-notifications .mm-notification-row strong {
  font-size:16px;line-height:1.4;font-weight:650;letter-spacing:-.15px;
}
html body.mm-app[data-mm-theme] #mm-notifications .mm-notification-copy>span {
  font-size:14px;line-height:1.5;color:var(--mm-muted);
}
html body.mm-app[data-mm-theme] #mm-notifications .mm-notification-copy>small {
  font-size:12px;font-variant-numeric:tabular-nums;color:var(--mm-muted);
}
html body.mm-app[data-mm-theme] #mm-notifications .mm-notification-copy>b {
  display:inline-block;margin-top:5px;font-size:14px;line-height:1.4;color:var(--experience-accent);font-weight:600;
}

/* Interaction feedback stays local; no blur or motion is added to message rows. */
html body.mm-app[data-mm-theme] .mm-list-pane :is(button,a,summary):focus-visible,
html body.mm-app.mm-direct[data-mm-theme] #room :is(.mm-chat-header,.mm-thread-shortcuts,.direct-compose) :is(button,a):focus-visible,
html body.mm-app[data-mm-theme] .mm-shell>.mm-bottom-nav>:is(button,a):focus-visible {
  outline:2px solid var(--experience-accent);outline-offset:-2px;
}
@media(hover:hover) {
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts>:is(button,a):hover,
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header :is(.mm-icon,[data-call-start]):hover,
  html body.mm-app.mm-direct[data-mm-theme] #room :is(.cqr-trigger,#clear-reply):hover,
  html body.mm-app.mm-direct[data-mm-theme] #room #free-form :is(#mm-emoji-button,#media-attach,#mm-camera-shortcut):hover {
    background:var(--mm-soft);color:var(--experience-accent);
  }
}
@media(max-width:760px) {
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header {
    padding:calc(7px + env(safe-area-inset-top,0px)) 6px 7px;gap:3px;min-height:64px;
  }
  html body.mm-app.mm-direct[data-mm-theme] #room #room-title {font-size:16px}
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header>#mm-room-avatar {width:38px;height:38px;flex-basis:38px}
  html body.mm-app[data-mm-theme] .mm-shell>.mm-bottom-nav {width:calc(100% - 16px);margin-inline:8px}
}
@media(max-width:359px) {
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header {gap:1px;padding-inline:3px}
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header>#mm-room-avatar {width:32px;height:32px;flex-basis:32px}
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts {padding-inline:8px;gap:6px}
  html body.mm-app[data-mm-theme] .mm-list-pane .connect-area-compact>a,
  html body.mm-app[data-mm-theme] .mm-list-pane .connect-area-more>summary {font-size:14px;letter-spacing:-.2px}
  html body.mm-app[data-mm-theme] .mm-shell>.mm-bottom-nav {width:calc(100% - 8px);margin-inline:4px;padding-inline:2px}
  html body.mm-app[data-mm-theme] .mm-bottom-nav>a[data-connect-destination="/marketplace"]>span {margin-inline:-8px;max-width:calc(100% + 16px);letter-spacing:-.6px}
}
@media(prefers-reduced-motion:no-preference) {
  html body.mm-app[data-mm-theme] .mm-list-pane .wcpa-header-actions #mm-new-chat,
  html body.mm-app.mm-direct[data-mm-theme] #room #free-form :is(#free-send,#media-record:not(.recording)) {
    transition:box-shadow 140ms ease,transform 140ms ease;
  }
  html body.mm-app[data-mm-theme] .mm-list-pane .wcpa-header-actions #mm-new-chat:active,
  html body.mm-app.mm-direct[data-mm-theme] #room #free-form :is(#free-send,#media-record:not(.recording)):active {
    transform:scale(.96);box-shadow:inset 0 1px 0 #ffffff24;
  }
}
@media(prefers-reduced-transparency:reduce),(prefers-contrast:more) {
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-chat-header {
    background:var(--mm-chrome)!important;backdrop-filter:none;-webkit-backdrop-filter:none;
  }
}
@media(forced-colors:active) {
  html body.mm-app[data-mm-theme] .mm-list-pane .wcpa-header-actions #mm-new-chat,
  html body.mm-app.mm-direct[data-mm-theme] #room #free-form :is(#free-send,#media-record:not(.recording)) {background:ButtonFace!important;color:ButtonText!important;border:1px solid ButtonText;box-shadow:none}
  html body.mm-app[data-mm-theme] .mm-list-pane .mm-filters>button[aria-pressed=true] {background:Highlight;color:HighlightText;border-color:Highlight}
  html body.mm-app.mm-direct[data-mm-theme] #room .mm-thread-shortcuts>:is(button,a) {border-color:ButtonText}
  html body.mm-app[data-mm-theme] .mm-list-pane .connect-message-requests[data-has-requests=true] {outline:2px solid Highlight;box-shadow:none}
}
/* Give long destination names enough room while retaining a 44px touch target. */
@media(max-width:359px){
 html body.mm-app.mm-direct[data-mm-theme] .mm-shell>.mm-bottom-nav{display:grid!important;grid-template-columns:1.2fr .8fr 1.4fr .8fr 1fr!important;gap:0!important;padding-inline:0!important}
 html body.mm-app.mm-direct[data-mm-theme] .mm-shell>.mm-bottom-nav>:is(button,a){min-width:0;min-height:44px}
 html body.mm-app.mm-direct[data-mm-theme] .mm-shell>.mm-bottom-nav>:is(button,a)>span:not(.connect-nav-unread){margin-inline:0;max-width:100%;letter-spacing:-.3px}
}
