/* Native widget nodes remain in place; no labels, IDs or click handlers changed.
 * SEND wrappers are laid out by ordinal position, independent of wording/count.
 * Only the dedicated LAST form CTA beside SEND controls is styled; earlier plain URL is not.
 */
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) { display: flow-root; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child) {
  float: left;
  display: block;
  box-sizing: border-box;
  width: calc(50% - 4px);
  max-width: 100%;
  min-width: 0;
  margin: 8px 8px 0 0 !important;
  white-space: normal;
}
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child):nth-child(even of :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child)) { margin-right: 0 !important; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child):nth-child(odd of :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child)) { clear: both; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child):nth-child(odd of :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child)):nth-last-child(1 of :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child)) {
  width: 100%; margin-right: 0 !important;
}
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > .bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]) > .bx-im-message-command[data-entity="send"],
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child {
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 40px;
  height: auto;
  max-height: none;
  min-width: 0;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background-color: #E9EDF2 !important;
  background-image: none !important;
  color: #20252B !important;
  box-shadow: none !important;
  font-family: inherit;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 20px;
  text-align: center;
  text-decoration: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
  cursor: pointer;
}
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > .bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]) > .bx-im-message-command[data-entity="send"] { width: 100%; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > .bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]) > .bx-im-message-command[data-entity="send"]:hover,
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child:hover { background-color: #DDE3EA !important; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > .bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]) > .bx-im-message-command[data-entity="send"]:focus-visible,
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child:focus-visible {
  outline: 3px solid #345B7E !important;
  outline-offset: 2px;
}
@media (max-width: 380px) {
  .bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child) { width: 100%; margin-right: 0 !important; clear: both; }
}
@media (forced-colors: active) {
  .bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > .bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]) > .bx-im-message-command[data-entity="send"],
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child { border: 1px solid ButtonText !important; background-color: ButtonFace !important; color: ButtonText !important; }
}

/* CSS layout correction: short replies get room; native SEND nodes/handlers stay intact. */
.bx-livechat-wrapper .bx-im-message-content-wrap:has(.bx-im-message-command[data-entity="send"]) {
  inline-size: 100%; min-inline-size: 0; max-inline-size: 100%;
}
.bx-livechat-wrapper .bx-im-message-content:has(.bx-im-message-command[data-entity="send"]) {
  inline-size: min(352px, 100%); min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box;
}
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) {
  display: flex; flex-wrap: wrap; align-items: stretch;
  inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box;
  column-gap: 8px; row-gap: 0; overflow-wrap: anywhere;
}
/* Keep native text breaks; ordinary links occupy a reply row, ahead of hints. */
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > a:not(a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child) { flex: 0 1 100%; min-inline-size: 0; max-inline-size: 100%; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"])::after { content: ""; order: 0; flex-basis: 100%; block-size: 0; }
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child) {
  order: 1; float: none; clear: none; display: flex !important;
  flex: 0 0 auto; width: calc(50% - 4px); min-width: 0;
  margin: 8px 0 0 !important; align-self: stretch;
}
.bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > .bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]) > .bx-im-message-command[data-entity="send"] {
  flex: 1 1 auto; align-self: stretch; height: auto;
}
@media (max-width: 340px) {
  .bx-livechat-wrapper .bx-im-message-content-text:has(> .bx-im-message-command-wrap > .bx-im-message-command[data-entity="send"]) > :is(.bx-im-message-command-wrap:has(> .bx-im-message-command[data-entity="send"]), a[href="https://b24-1yqj9l.bitrix24.site/crm_form_fmmva/"]:last-child) { width: 100%; }
}
