/* Message tails: a triangular flag from the bottom edge at the corner facing the panel centre, as
   two border triangles (outline behind, fill 1px smaller in front; the outline's anchor 1px further
   out on both axes, or it paints under the fill). Desktop twin: chatWidgets.cpp. */
.chat-msg-user::before, .chat-msg-user::after,
.chat-msg-assistant::before, .chat-msg-assistant::after,
.chat-msg-error::before, .chat-msg-error::after {
    content: ""; position: absolute; border-style: solid;
}
.chat-msg-user::before { bottom: -1px; right: -10px; border-width: 9px 0 0 9px; border-color: transparent transparent transparent var(--msg-border); }
.chat-msg-user::after { bottom: 0; right: -8px; border-width: 8px 0 0 8px; border-color: transparent transparent transparent var(--msg-fill); }
.chat-msg-assistant::before, .chat-msg-error::before {
    bottom: -1px; left: -10px; border-width: 9px 9px 0 0; border-color: transparent var(--msg-border) transparent transparent;
}
.chat-msg-assistant::after, .chat-msg-error::after {
    bottom: 0; left: -8px; border-width: 8px 8px 0 0; border-color: transparent var(--msg-fill) transparent transparent;
}
/* Swapped sides: `.chat-swapped` on a transcript (one preference, either surface) flips every
   bubble at once — alignment, tail geometry and the row "…" trigger's side. */
.chat-swapped .chat-msg-user {
    align-self: flex-start;
    border-bottom-right-radius: 10px; border-bottom-left-radius: 0;
}
.chat-swapped .chat-msg-assistant,
.chat-swapped .chat-msg-error {
    align-self: flex-end;
    border-bottom-left-radius: 10px; border-bottom-right-radius: 0;
}
.chat-swapped .chat-msg-user::before {
    right: auto; bottom: -1px; left: -10px; border-width: 9px 9px 0 0; border-color: transparent var(--msg-border) transparent transparent;
}
.chat-swapped .chat-msg-user::after {
    right: auto; bottom: 0; left: -8px; border-width: 8px 8px 0 0; border-color: transparent var(--msg-fill) transparent transparent;
}
.chat-swapped .chat-msg-assistant::before,
.chat-swapped .chat-msg-error::before {
    left: auto; bottom: -1px; right: -10px; border-width: 9px 0 0 9px; border-color: transparent transparent transparent var(--msg-border);
}
.chat-swapped .chat-msg-assistant::after,
.chat-swapped .chat-msg-error::after {
    left: auto; bottom: 0; right: -8px; border-width: 8px 0 0 8px; border-color: transparent transparent transparent var(--msg-fill);
}
.chat-swapped .chat-row-menu-btn-left { left: auto; right: -27px; }
.chat-swapped .chat-row-menu-btn-right { right: auto; left: -27px; }
