/* IUAI_RESEARCH_USER_BUBBLE_VISIBILITY_R145_20261011
   Fixes user Research Intake messages being rendered but clipped outside the visible column.
   Root cause: R14.3 combined overflow:hidden on the thread with grid auto-margin alignment
   on width:max-content user turns.
*/

body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6,
#workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 {
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  width:100%!important;
  max-width:100%!important;
  margin-left:auto!important;
  margin-right:auto!important;
  overflow:visible!important;
  box-sizing:border-box!important;
}

/* Keep every turn inside the same visible 920px Research column. */
body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6,
#workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6 {
  box-sizing:border-box!important;
  min-width:0!important;
}

/* User messages: right aligned, but never shifted outside the thread. */
body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6.user,
#workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6.user {
  align-self:flex-end!important;
  justify-self:auto!important;
  width:fit-content!important;
  max-width:min(84%,760px)!important;
  margin:0!important;
  transform:none!important;
  right:auto!important;
  left:auto!important;
}

/* Assistant messages stay on the left and retain the IU avatar offset. */
body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6.assistant,
#workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6.assistant {
  align-self:flex-start!important;
  justify-self:auto!important;
  max-width:calc(100% - 45px)!important;
}

/* Runtime user turns (after formal research / follow-up) use the same right edge. */
body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1,
#workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 {
  width:100%!important;
  max-width:100%!important;
  overflow:visible!important;
  box-sizing:border-box!important;
}
body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 > .research-conv-row-v1.user,
#workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 > .research-conv-row-v1.user {
  width:100%!important;
  max-width:100%!important;
  display:flex!important;
  justify-content:flex-end!important;
  overflow:visible!important;
}
body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 > .research-conv-row-v1.user > .research-conv-bubble-v1,
#workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 > .research-conv-row-v1.user > .research-conv-bubble-v1 {
  width:fit-content!important;
  max-width:min(84%,760px)!important;
  margin:0!important;
  transform:none!important;
}

@media(max-width:700px){
  body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6.user,
  #workspace [data-app-view="research"].research-conversation-v1 #research-intake-thread-v6 > .intake-turn-v6.user,
  body.workspace-flow-active #workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 > .research-conv-row-v1.user > .research-conv-bubble-v1,
  #workspace [data-app-view="research"].research-conversation-v1 #research-runtime-v1 > .research-conv-row-v1.user > .research-conv-bubble-v1 {
    max-width:92%!important;
  }
}
