/* SyntaxMatrix user-message copy/edit v3 - content wrapper fix */
#chat-history .chat-message.user{margin-bottom:34px!important;overflow:visible!important}
#chat-history .chat-message.user .bubble-tools{position:absolute!important;right:0!important;bottom:-31px!important;display:inline-flex!important;align-items:center!important;gap:3px!important;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;opacity:0!important;pointer-events:none!important;transform:translateY(-2px);transition:opacity .14s ease,transform .14s ease}
#chat-history .chat-message.user:hover .bubble-tools,#chat-history .chat-message.user:focus-within .bubble-tools,#chat-history .chat-message.user .bubble-tools:focus-within{opacity:1!important;pointer-events:auto!important;transform:translateY(0)}
.bubble-tools button{all:unset;display:inline-flex!important;align-items:center!important;justify-content:center!important;width:29px!important;height:29px!important;border-radius:8px!important;color:#4b5563!important;cursor:pointer!important}
.bubble-tools button:hover,.bubble-tools button:focus-visible{background:rgba(15,23,42,.08)!important;color:#111827!important;outline:none!important}
.bubble-tools svg{width:18px;height:18px;pointer-events:none}
.chat-message.user.editing{min-width:min(520px,72vw)}
#chat-history .chat-message.user.editing>.smx-chat-message-content,
#chat-history .chat-message.user.editing>p,
#chat-history .chat-message.user.editing>.bubble-tools{display:none!important}
.bubble-editor{position:relative;width:100%;min-height:142px;border:1px solid #94a3b8;border-radius:18px;background:#fff;box-sizing:border-box;overflow:hidden}
.bubble-editor textarea{display:block;width:100%;min-height:142px;max-height:260px;padding:14px 16px 62px;border:0;border-radius:18px;box-sizing:border-box;resize:vertical;font:inherit;line-height:1.45;background:transparent;outline:none}
.bubble-editor textarea:focus{outline:none}
.bubble-editor-actions{position:absolute;right:12px;bottom:10px;display:flex;justify-content:flex-end;gap:8px;margin:0}
.bubble-editor-actions button{min-height:40px;padding:7px 16px;border:1px solid #cbd5e1;border-radius:999px;background:#fff;cursor:pointer;font:inherit}
.bubble-editor-actions .save-edit{border-color:#111827;background:#111827;color:#fff}
.bubble-editor-error{position:absolute;left:16px;right:170px;bottom:18px;color:#b91c1c;font-size:.82rem}
@media(max-width:700px){.chat-message.user.editing{min-width:min(88vw,520px)}}

/* SyntaxMatrix bot response copy action v1 */

#chat-history .chat-message.bot,
#chat-history .chat-message.assistant{
  position:relative!important;
}

#chat-history .chat-message.bot>.bot-bubble-tools,
#chat-history .chat-message.assistant>.bot-bubble-tools{
  position:absolute!important;
  top:12px!important;
  right:12px!important;
  z-index:3!important;

  display:inline-flex!important;
  align-items:center!important;

  padding:0!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;

  opacity:1!important;
  pointer-events:auto!important;
}

/* Do not expose Copy while an answer is still arriving. */
#chat-history .chat-message.bot.streaming>.bot-bubble-tools,
#chat-history .chat-message.assistant.streaming>.bot-bubble-tools{
  opacity:0!important;
  pointer-events:none!important;
}

#chat-history .bot-bubble-tools button{
  all:unset!important;

  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;

  width:29px!important;
  height:29px!important;

  border-radius:8px!important;
  color:#111827!important;
  cursor:pointer!important;
  box-sizing:border-box!important;
}

#chat-history .bot-bubble-tools button:hover,
#chat-history .bot-bubble-tools button:focus-visible{
  background:rgba(15,23,42,.08)!important;
  outline:none!important;
}

#chat-history .bot-bubble-tools svg{
  width:19px!important;
  height:19px!important;
  pointer-events:none!important;
}

/* Keep response text from running underneath the top-right button. */
#chat-history .chat-message.bot>.smx-chat-message-content,
#chat-history .chat-message.bot>.smx-structured,
#chat-history .chat-message.bot>.stream-target,
#chat-history .chat-message.assistant>.smx-chat-message-content,
#chat-history .chat-message.assistant>.smx-structured,
#chat-history .chat-message.assistant>.stream-target{
  padding-right:34px!important;
  box-sizing:border-box!important;
}
