/* wire-canonical-message-avatar-303f1h9159e */

/*
 * h9159e no longer trusts historical avatar DOM/crop wrappers inside a
 * message row. The runtime creates one purpose-built message avatar with a
 * fresh IMG element, while the old h683 clones are suppressed.
 */

/* Hide every legacy incoming-avatar owner unless it is our canonical wrapper. */
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-peer-avatar-303f1h683:not(.wire-message-avatar-303f1h9159e),
.message-thread
.direct-message:not(.own)[data-message-id]
> .avatar:not(.wire-message-avatar-303f1h9159e),
.message-thread
.direct-message:not(.own)[data-message-id]
> .avatar-xs:not(.wire-message-avatar-303f1h9159e),
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-avatar:not(.wire-message-avatar-303f1h9159e),
.message-thread
.direct-message:not(.own)[data-message-id]
> img[class*="avatar"]:not(.wire-message-avatar-303f1h9159e){
  display:none!important;
  width:0!important;
  min-width:0!important;
  max-width:0!important;
  height:0!important;
  min-height:0!important;
  max-height:0!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  overflow:hidden!important;
}

/* Also suppress any old avatar that was accidentally moved inside h9159b's stack. */
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b
> .wire-message-peer-avatar-303f1h683,
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b
> .avatar,
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b
> .avatar-xs,
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b
> .wire-avatar,
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b
> img[class*="avatar"]{
  display:none!important;
}

/* Explicit incoming row geometry. */
.message-thread
.direct-message:not(.own)[data-message-id]{
  display:grid!important;
  grid-template-columns:30px minmax(0,1fr)!important;
  grid-template-rows:max-content!important;
  column-gap:8px!important;
  row-gap:0!important;
  align-items:end!important;
  justify-items:stretch!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  height:auto!important;
  overflow:visible!important;
}

/* The one and only incoming message avatar. */
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-avatar-303f1h9159e{
  position:static!important;
  inset:auto!important;
  grid-column:1!important;
  grid-row:1!important;
  align-self:end!important;
  justify-self:center!important;
  order:initial!important;

  display:grid!important;
  place-items:center!important;
  flex:none!important;

  width:30px!important;
  min-width:30px!important;
  max-width:30px!important;
  height:30px!important;
  min-height:30px!important;
  max-height:30px!important;

  /* Footer is 20px high + 3px gap: align avatar with bubble bottom. */
  margin:0 0 23px 0!important;
  padding:0!important;

  border:1px solid #3b5269!important;
  border-radius:50%!important;
  background:#16283a!important;
  color:#dcecff!important;
  box-sizing:border-box!important;
  overflow:hidden!important;

  font-size:10px!important;
  font-weight:850!important;
  line-height:1!important;
  text-align:center!important;

  transform:none!important;
  float:none!important;
  clear:none!important;
}

/*
 * Fresh IMG receives no crop wrapper, translate, scale, aspect-ratio,
 * background positioning, or inherited avatar sizing from the profile system.
 */
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-avatar-303f1h9159e
> img{
  position:static!important;
  inset:auto!important;
  display:block!important;

  width:100%!important;
  min-width:100%!important;
  max-width:100%!important;
  height:100%!important;
  min-height:100%!important;
  max-height:100%!important;

  margin:0!important;
  padding:0!important;

  border:0!important;
  border-radius:50%!important;

  object-fit:cover!important;
  object-position:center center!important;

  transform:none!important;
  translate:none!important;
  scale:none!important;
  rotate:none!important;

  clip:auto!important;
  clip-path:none!important;
  filter:none!important;
}

/* Message content stays in column 2. */
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b{
  grid-column:2!important;
  grid-row:1!important;
  align-self:start!important;
  justify-self:start!important;

  width:fit-content!important;
  min-width:0!important;
  max-width:min(76%,560px)!important;

  margin:0!important;
  padding:0!important;
  position:relative!important;
  inset:auto!important;
  float:none!important;
  transform:none!important;
}

/* Outgoing rows never display or reserve a message avatar. */
.message-thread
.direct-message.own[data-message-id]
> .wire-message-avatar-303f1h9159e,
.message-thread
.direct-message.own[data-message-id]
> .wire-message-peer-avatar-303f1h683,
.message-thread
.direct-message.own[data-message-id]
> .avatar,
.message-thread
.direct-message.own[data-message-id]
> .avatar-xs,
.message-thread
.direct-message.own[data-message-id]
> .wire-avatar{
  display:none!important;
}

/* Keep compact footer aligned with its incoming bubble. */
.message-thread
.direct-message:not(.own)[data-message-id]
> .wire-message-stack-303f1h9159b
> .wire-message-actions-303f1h680a{
  justify-self:start!important;
  justify-content:flex-start!important;
}

@media(max-width:980px){
  .message-thread
  .direct-message:not(.own)[data-message-id]{
    grid-template-columns:28px minmax(0,1fr)!important;
    column-gap:7px!important;
  }

  .message-thread
  .direct-message:not(.own)[data-message-id]
  > .wire-message-avatar-303f1h9159e{
    width:28px!important;
    min-width:28px!important;
    max-width:28px!important;
    height:28px!important;
    min-height:28px!important;
    max-height:28px!important;
    margin-bottom:25px!important;
  }

  .message-thread
  .direct-message:not(.own)[data-message-id]
  > .wire-message-stack-303f1h9159b{
    max-width:84%!important;
  }
}

@media(max-width:680px){
  .message-thread
  .direct-message:not(.own)[data-message-id]{
    column-gap:6px!important;
  }

  .message-thread
  .direct-message:not(.own)[data-message-id]
  > .wire-message-stack-303f1h9159b{
    max-width:86%!important;
  }
}