/* Chatbot panel (right) — chatbot-resize.js, class-astra-child-chatbot.php */

.mwai-popbot-theme.mwai-window:not(.mwai-open) {
  right: 15px !important;
  bottom: 100px !important;
}

#mwai-chatbot-popbot.mwai-window.mwai-open.ac-panel-positioned {
  right: auto !important;
  bottom: auto !important;
  box-sizing: border-box;
  z-index: 9999;
  overflow: visible;
}

.mwai-popbot-theme.mwai-window.mwai-open.ac-panel-positioned .mwai-conversation {
  max-height: none !important;
}

.mwai-popbot-theme .mwai-trigger {
  bottom: 80px !important;
}

/* Keep the outer window box from clipping the resize handle */
.mwai-chat.mwai-window.mwai-open {
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Fill the panel height (match Tag Cloud window; override plugin 40vh cap) */
.mwai-popbot-theme.mwai-window.mwai-open .mwai-window-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.mwai-popbot-theme.mwai-window.mwai-open .mwai-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
}
.mwai-popbot-theme.mwai-window.mwai-open .mwai-conversation {
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

/* Panel/window titles — match chatbot header (16px) */
.mwai-popbot-theme.mwai-window .mwai-header .mwai-name,
.mwai-popbot-theme.mwai-window .mwai-header .mwai-name-text,
.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-name,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-name,
.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-name-text,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-name-text {
  display: none !important;
}

/* Guest membership CTA between prompt input and usage bar */
#mwai-chatbot-popbot .ac-membership-cta,
.mwai-window#mwai-chatbot-popbot .ac-membership-cta {
  margin: 8px 12px 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d0ddf5;
  background: var(--ast-global-color-5, #f0f5fa);
  font-size: 12px;
  line-height: 1.4;
  color: #334155;
  text-align: center;
  flex: 0 0 auto;
  box-sizing: border-box;
}

#mwai-chatbot-popbot .ac-membership-cta a,
.mwai-window#mwai-chatbot-popbot .ac-membership-cta a {
  color: #046bd2;
  font-weight: 600;
  text-decoration: none;
}

#mwai-chatbot-popbot .ac-membership-cta a:hover,
.mwai-window#mwai-chatbot-popbot .ac-membership-cta a:hover,
#mwai-chatbot-popbot .ac-membership-cta a:focus,
.mwai-window#mwai-chatbot-popbot .ac-membership-cta a:focus {
  text-decoration: underline;
}

/* AI usage bar below chatbot input (matches header blue #0084ff) */
#mwai-chatbot-popbot .ac-chatbot-usage.mwai-statistics-usage,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-usage.mwai-statistics-usage {
  /*display: flex !important;*/
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 12px 6px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  flex: 0 0 auto;
  box-sizing: border-box;
}

#mwai-chatbot-popbot.mwai-open .mwai-body .mwai-fullscreen-spacer,
.mwai-window#mwai-chatbot-popbot.mwai-open .mwai-body .mwai-fullscreen-spacer {
  display: none !important;
}

.mwai-window#mwai-chatbot-popbot.mwai-open .mwai-body:has(.ac-chatbot-usage),
#mwai-chatbot-popbot.mwai-open .mwai-body:has(.ac-chatbot-usage) {
  display: flex;
  flex-direction: column;
}

.mwai-window#mwai-chatbot-popbot.mwai-open .mwai-body:has(.ac-chatbot-usage) .mwai-conversation,
#mwai-chatbot-popbot.mwai-open .mwai-body:has(.ac-chatbot-usage) .mwai-conversation {
  flex: 1 1 auto;
  min-height: 0;
}

.mwai-window#mwai-chatbot-popbot.mwai-open .mwai-body:has(.ac-chatbot-usage) .mwai-input,
#mwai-chatbot-popbot.mwai-open .mwai-body:has(.ac-chatbot-usage) .mwai-input {
  flex: 0 0 auto;
}

/* Popbot custom theme CSS is served via REST; fix broken relative sprite path */
.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-file-upload-icon {
  background-image: url(/wp-content/plugins/ai-engine-pro/themes/icons/white-icons.svg);
}

/*
 * Input controls:
 * [textarea] [Send]
 * Mic, upload, and clear live in the footer tools row.
 *
 * AI Engine now places Send inside the input wrapper by default. Keep the
 * original popbot layout with Send beside the textarea instead of overlaying
 * it inside the field.
 */
.mwai-popbot-theme .mwai-input .mwai-input-text,
#mwai-chatbot-popbot .mwai-input .mwai-input-text {
  display: flex;
  align-items: flex-end;
  min-width: 0;
}

.mwai-popbot-theme .mwai-input .mwai-input-text textarea,
#mwai-chatbot-popbot .mwai-input .mwai-input-text textarea {
  max-height: min(200px, 35vh);
  overflow-y: auto !important;
  padding-right: var(--mwai-spacing, 12px);
}

.mwai-popbot-theme .mwai-input .mwai-input-submit,
#mwai-chatbot-popbot .mwai-input .mwai-input-submit {
  position: static;
  right: auto;
  top: auto;
  bottom: auto;
  transform: none;
  flex: 0 0 auto;
  align-self: flex-end;
  margin: 0 0 8px 8px;
}

.mwai-popbot-theme .mwai-input .mwai-input-submit:hover,
#mwai-chatbot-popbot .mwai-input .mwai-input-submit:hover {
  transform: scale(1.03);
}

/*
 * AI Engine MwaiFiles chips (multiUpload only). Style like Perplexity:
 * compact gray chips above the prompt input.
 */
#mwai-chatbot-popbot .mwai-body > .mwai-files,
.mwai-window#mwai-chatbot-popbot .mwai-body > .mwai-files,
#mwai-chatbot-popbot .mwai-files,
.mwai-window#mwai-chatbot-popbot .mwai-files {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px 0;
  margin: 0;
  background: transparent;
  border: 0;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview {
  position: relative;
  max-width: min(100%, 280px);
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-content,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-thumbnail,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-thumbnail {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 0;
  object-fit: cover;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-icon,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #e5e7eb;
  color: #6b7280;
  opacity: 1;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-name,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-name {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-size,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-size {
  font-size: 11px;
  color: #6b7280;
  opacity: 1;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-remove,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-remove {
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 4px;
  border-radius: 999px;
  opacity: 0.7;
  color: #6b7280;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-remove:hover,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-remove:hover {
  opacity: 1;
  background: #e5e7eb;
  color: #111827;
}

#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-remove svg,
.mwai-window#mwai-chatbot-popbot .mwai-files .mwai-file-preview .mwai-file-remove svg {
  width: 14px;
  height: 14px;
}

/* Mic — left of the text field */
.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone,
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone {
  order: -1;
  position: static;
  transform: none;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px;
  min-height: 32px;
  margin: 0 0 0 4px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 50%;
  color: var(--mwai-fontColor, #1f2937);
  cursor: pointer;
  filter: none !important;
  z-index: 2;
}

.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone svg,
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone svg {
  display: block;
  width: 18px;
  height: 18px;
  color: inherit;
  opacity: 0.7;
  filter: none;
  transition: opacity 0.15s ease;
}

.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone:hover,
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone:hover {
  background: rgba(0, 0, 0, 0.06) !important;
}

.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone:hover svg,
.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone[active="true"] svg,
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone:hover svg,
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone[active="true"] svg {
  opacity: 1;
}

.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone[disabled],
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.mwai-popbot-theme .mwai-input .mwai-input-text .mwai-microphone[disabled] svg,
#mwai-chatbot-popbot .mwai-input .mwai-input-text .mwai-microphone[disabled] svg {
  opacity: 0.7;
}

/* Pro member toolbar: Clear, Upload, web search pills, settings gear */
#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label],
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label] {
  position: relative;
  overflow: visible !important;
}

/* Explicit tip element — reliable vs ::before clipping (model/translate wrappers) */
#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-hover-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  top: auto;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f2937;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 10005;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:hover > .ac-hover-tip,
#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:focus-visible > .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:hover > .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:focus-visible > .ac-hover-tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Keep ::before labels only when no explicit tip element is present */
#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:not(:has(> .ac-hover-tip))::before,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:not(:has(> .ac-hover-tip))::before {
  content: attr(data-hover-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f2937;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 10005;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:not(:has(> .ac-hover-tip)):hover::before,
#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:not(:has(> .ac-hover-tip)):focus-visible::before,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:not(:has(> .ac-hover-tip)):hover::before,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:not(:has(> .ac-hover-tip)):focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:has(> .ac-hover-tip)::before,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools [data-hover-label]:has(> .ac-hover-tip)::before {
  content: none;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  row-gap: 6px;
  min-width: 0;
  overflow: visible;
}

#mwai-chatbot-popbot .mwai-footer,
.mwai-window#mwai-chatbot-popbot .mwai-footer {
  overflow: visible;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-sidebar-restore--footer[data-hover-label]::before,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-sidebar-restore--footer[data-hover-label]::before {
  content: none;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[data-hover-label],
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[data-hover-label],
#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload[data-hover-label],
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload[data-hover-label],
#mwai-chatbot-popbot .ac-chatbot-settings-link[data-hover-label],
.mwai-window#mwai-chatbot-popbot .ac-chatbot-settings-link[data-hover-label],
#mwai-chatbot-popbot .ac-chatbot-translate-toggle[data-hover-label],
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-toggle[data-hover-label],
#mwai-chatbot-popbot .ac-chatbot-model-toggle[data-hover-label],
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-toggle[data-hover-label],
#mwai-chatbot-popbot .ac-sidebar-restore--footer[data-hover-label],
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--footer[data-hover-label] {
  position: relative !important;
  overflow: visible !important;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools.ac-chatbot-tools-row,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools.ac-chatbot-tools-row {
  flex: 1 1 auto;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload:hover,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload:hover {
  background: #eef6ff;
  border-color: #93c5fd;
  color: var(--mwai-backgroundHeaderColor, #0084ff);
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0 !important;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff !important;
  color: #475569;
  cursor: pointer;
  position: static;
  transform: none;
  filter: none !important;
  box-sizing: border-box;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone svg,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone svg {
  display: block;
  width: 14px;
  height: 14px;
  color: inherit;
  opacity: 0.9;
  filter: none;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone:hover,
#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[active="true"],
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone:hover,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[active="true"] {
  background: #eef6ff !important;
  border-color: #93c5fd;
  color: var(--mwai-backgroundHeaderColor, #0084ff);
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone:hover svg,
#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[active="true"] svg,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone:hover svg,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[active="true"] svg {
  opacity: 1;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[disabled],
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-microphone[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload-icon,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0;
  color: inherit;
  opacity: 0.9;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload-icon.mwai-lucide svg,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .mwai-file-upload-icon.mwai-lucide svg {
  display: block;
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* File upload uses a sprite in the input; in the footer use a dark sprite so it is visible */
#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-chatbot-file-upload .mwai-file-upload-icon:not(.mwai-lucide),
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-chatbot-file-upload .mwai-file-upload-icon:not(.mwai-lucide) {
  background-image: url(/wp-content/plugins/ai-engine-pro/themes/icons/dark-icons.svg);
  background-size: 500%;
  background-position: -32px -96px;
  background-repeat: no-repeat;
  width: 20px;
  height: 20px;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-chatbot-file-upload .mwai-file-upload-icon.mwai-idle-add:not(.mwai-lucide),
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools .ac-chatbot-file-upload .mwai-file-upload-icon.mwai-idle-add:not(.mwai-lucide) {
  background-position: -32px -96px;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools.ac-chatbot-basic-row,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools.ac-chatbot-basic-row {
  flex: 1 1 auto;
  justify-content: flex-start;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-options,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-options {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  margin-left: 0;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
  position: relative;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option input,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option:not(.is-active):not(:has(input:checked)) .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option:not(.is-active):not(:has(input:checked)) .ac-chatbot-web-search-option-label {
  opacity: 0.35;
  filter: grayscale(0.5);
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option:not(.is-active):not(:has(input:checked)):hover .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option:not(.is-active):not(:has(input:checked)):hover .ac-chatbot-web-search-option-label {
  opacity: 0.7;
  filter: grayscale(0.15);
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option-icon,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option-icon {
  display: block;
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex: 0 0 15px;
  pointer-events: none;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option:hover .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option:hover .ac-chatbot-web-search-option-label {
  border-color: #93c5fd;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option.is-active .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option.is-active .ac-chatbot-web-search-option-label,
#mwai-chatbot-popbot .ac-chatbot-web-search-option:has(input:checked) .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option:has(input:checked) .ac-chatbot-web-search-option-label {
  background: #dbeafe;
  border: 2px solid #0084ff;
  box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.2);
  color: #0f172a;
  opacity: 1;
  filter: none;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option.is-active .ac-chatbot-web-search-option-label::after,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option.is-active .ac-chatbot-web-search-option-label::after,
#mwai-chatbot-popbot .ac-chatbot-web-search-option:has(input:checked) .ac-chatbot-web-search-option-label::after,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option:has(input:checked) .ac-chatbot-web-search-option-label::after {
  content: '';
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 11px;
  height: 11px;
  border: 1.5px solid #ffffff;
  border-radius: 999px;
  background-color: #0084ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 4.8 8.5 9.5 3.8' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 9px 9px;
  pointer-events: none;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-option.is-locked,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-option.is-locked {
  cursor: default;
}

#mwai-chatbot-popbot .ac-chatbot-web-search-options.is-locked .ac-chatbot-web-search-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-web-search-options.is-locked .ac-chatbot-web-search-option-label {
  opacity: 0.9;
}

#mwai-chatbot-popbot .mwai-footer .mwai-tools.is-saving .ac-chatbot-web-search-options,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools.is-saving .ac-chatbot-web-search-options {
  opacity: 0.7;
  pointer-events: none;
}

#mwai-chatbot-popbot .ac-chatbot-settings-link,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-settings-link,
#mwai-chatbot-popbot .ac-chatbot-translate-toggle,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-left: 0;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#mwai-chatbot-popbot .ac-chatbot-settings-link:hover,
#mwai-chatbot-popbot .ac-chatbot-settings-link:focus,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-settings-link:hover,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-settings-link:focus,
#mwai-chatbot-popbot .ac-chatbot-translate-toggle:hover,
#mwai-chatbot-popbot .ac-chatbot-translate-toggle:focus,
#mwai-chatbot-popbot .ac-chatbot-translate-menu.is-open .ac-chatbot-translate-toggle,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-toggle:hover,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-toggle:focus,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-menu.is-open .ac-chatbot-translate-toggle {
  background: #eef6ff;
  border-color: #93c5fd;
  color: var(--mwai-backgroundHeaderColor, #0084ff);
  outline: none;
}

#mwai-chatbot-popbot .ac-chatbot-settings-icon,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-settings-icon,
#mwai-chatbot-popbot .ac-chatbot-translate-icon,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

#mwai-chatbot-popbot .ac-chatbot-translate-menu,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-menu {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  overflow: visible;
}

#mwai-chatbot-popbot .ac-chatbot-translate-menu .ac-translate-panel,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-translate-menu .ac-translate-panel {
  left: 50%;
  right: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 80;
}

#mwai-chatbot-popbot .ac-chatbot-model-picker,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-picker {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  overflow: visible;
}

#mwai-chatbot-popbot .ac-chatbot-model-toggle,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#mwai-chatbot-popbot .ac-chatbot-model-toggle:hover,
#mwai-chatbot-popbot .ac-chatbot-model-toggle:focus-visible,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-toggle:hover,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-toggle:focus-visible,
#mwai-chatbot-popbot .ac-chatbot-model-picker.is-open .ac-chatbot-model-toggle,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-picker.is-open .ac-chatbot-model-toggle {
  background: #eef6ff;
  border-color: #93c5fd;
  color: var(--mwai-backgroundHeaderColor, #0084ff);
  outline: none;
}

#mwai-chatbot-popbot .ac-chatbot-model-icon,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

#mwai-chatbot-popbot .ac-chatbot-model-panel,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-panel {
  position: absolute;
  left: 0;
  right: auto;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 24px));
  max-height: min(360px, 50vh);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

#mwai-chatbot-popbot .ac-chatbot-model-panel.is-viewport-positioned,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-panel.is-viewport-positioned {
  position: fixed;
  right: auto;
  bottom: auto;
}

#mwai-chatbot-popbot .ac-chatbot-model-picker:not(.is-open) .ac-chatbot-model-panel,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-picker:not(.is-open) .ac-chatbot-model-panel {
  display: none;
}

#mwai-chatbot-popbot .ac-chatbot-model-search,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-search {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

#mwai-chatbot-popbot .ac-chatbot-model-search-input,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.3;
}

#mwai-chatbot-popbot .ac-chatbot-model-search-input:focus,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-search-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.15);
}

#mwai-chatbot-popbot .ac-chatbot-model-list,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-list {
  overflow: auto;
  padding: 8px;
}

#mwai-chatbot-popbot .ac-chatbot-model-group + .ac-chatbot-model-group,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-group + .ac-chatbot-model-group {
  margin-top: 10px;
}

#mwai-chatbot-popbot .ac-chatbot-model-group--current,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-group--current {
  margin-bottom: 2px;
}

#mwai-chatbot-popbot .ac-chatbot-model-group--current .ac-chatbot-model-group-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-group--current .ac-chatbot-model-group-label {
  color: #0084ff;
}

#mwai-chatbot-popbot .ac-chatbot-model-option.is-current,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option.is-current {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.12);
  color: #0f172a;
  font-weight: 600;
}

#mwai-chatbot-popbot .ac-chatbot-model-group-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-group-label {
  padding: 2px 8px 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#mwai-chatbot-popbot .ac-chatbot-model-group-items,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#mwai-chatbot-popbot .ac-chatbot-model-option,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

#mwai-chatbot-popbot .ac-chatbot-model-option:hover,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option:hover,
#mwai-chatbot-popbot .ac-chatbot-model-option:focus-visible,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option:focus-visible {
  background: #eef6ff;
  outline: none;
}

#mwai-chatbot-popbot .ac-chatbot-model-option.is-selected,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option.is-selected {
  background: #dbeafe;
  color: #0f172a;
  font-weight: 600;
}

#mwai-chatbot-popbot .ac-chatbot-model-option-lead,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option-lead,
.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

#mwai-chatbot-popbot .ac-chatbot-model-option-icon,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option-icon,
.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

#mwai-chatbot-popbot .ac-chatbot-model-option-label,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mwai-chatbot-popbot .ac-chatbot-model-option-check,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-option-check {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  background-color: #0084ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 4.8 8.5 9.5 3.8' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
  border-radius: 999px;
}

#mwai-chatbot-popbot .ac-chatbot-model-empty,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-empty {
  padding: 16px 10px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.ac-chatbot-model-panel.is-portaled {
  position: fixed;
  /* Above AI Engine fullscreen (999999) and side panels (1000001 / 1000020). */
  z-index: 10001000;
  display: flex;
  flex-direction: column;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-search {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.3;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-search-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.15);
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-list {
  overflow: auto;
  padding: 8px;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-group + .ac-chatbot-model-group {
  margin-top: 10px;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-group--current .ac-chatbot-model-group-label {
  color: #0084ff;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option.is-current {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.12);
  color: #0f172a;
  font-weight: 600;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-group-label {
  padding: 2px 8px 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option:hover,
.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option:focus-visible {
  background: #eef6ff;
  outline: none;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option.is-selected {
  background: #dbeafe;
  color: #0f172a;
  font-weight: 600;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-option-check {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  background-color: #0084ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 4.8 8.5 9.5 3.8' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
  border-radius: 999px;
}

.ac-chatbot-model-panel.is-portaled .ac-chatbot-model-empty {
  padding: 16px 10px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.ac-chatbot-model-panel.is-portaled.is-saving {
  opacity: 0.7;
  pointer-events: none;
}

#mwai-chatbot-popbot .ac-chatbot-model-picker.is-saving .ac-chatbot-model-panel,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-model-picker.is-saving .ac-chatbot-model-panel,
#mwai-chatbot-popbot .mwai-footer .mwai-tools.is-saving .ac-chatbot-model-picker,
.mwai-window#mwai-chatbot-popbot .mwai-footer .mwai-tools.is-saving .ac-chatbot-model-picker {
  opacity: 0.7;
  pointer-events: none;
}

#mwai-chatbot-popbot .mwai-footer:has(.ac-chatbot-web-search-options),
.mwai-window#mwai-chatbot-popbot .mwai-footer:has(.ac-chatbot-web-search-options) {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 6px;
}

.mwai-window#mwai-chatbot-popbot.ac-history-open .ac-chatbot-usage,
#mwai-chatbot-popbot.mwai-window.ac-history-open .ac-chatbot-usage {
  min-height: 44px;
}

#mwai-chatbot-popbot .ac-chatbot-usage .mwai-statistics-bar-container,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-usage .mwai-statistics-bar-container {
  flex: 1 1 auto;
  background: #e8f2ff;
  border-radius: 6px;
  padding: 3px;
  height: 22px;
}

#mwai-chatbot-popbot .ac-chatbot-usage .mwai-statistics-bar,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-usage .mwai-statistics-bar {
  background: var(--mwai-backgroundHeaderColor, #0084ff) !important;
  border-radius: 4px;
  height: 100%;
  min-width: 4px;
}

#mwai-chatbot-popbot .ac-chatbot-usage .mwai-statistics-bar-text,
.mwai-window#mwai-chatbot-popbot .ac-chatbot-usage .mwai-statistics-bar-text {
  color: #334155 !important;
  font-size: 12px;
  font-weight: 600;
  padding-left: 0;
  min-width: 2.5em;
  justify-content: flex-end;
}

/* Drag-resize handles (chatbot-resize.js, left-window.js) — single outer grip line */
.mwai-custom-resize-handle {
  position: absolute;
  bottom: 0;
  width: 18px;
  height: 18px;
  z-index: 10000;
}

/* Bottom-right (SE) */
.mwai-custom-resize-handle.mwai-rh-se {
  right: 0;
  cursor: nwse-resize;
  background: linear-gradient(
    135deg,
    transparent 58%,
    rgba(0, 132, 255, 0.55) 58%,
    rgba(0, 132, 255, 0.55) 72%,
    transparent 72%
  );
  border-radius: 0 0 var(--mwai-borderRadius, 10px) 0;
}

/* Bottom-left (SW) */
.mwai-custom-resize-handle.mwai-rh-sw {
  left: 0;
  cursor: nesw-resize;
  background: linear-gradient(
    -135deg,
    transparent 58%,
    rgba(0, 132, 255, 0.55) 58%,
    rgba(0, 132, 255, 0.55) 72%,
    transparent 72%
  );
  border-radius: 0 0 0 var(--mwai-borderRadius, 10px);
}

/* Quick-action buttons appended to AJAX-loaded blog posts */
.ac-chatbot-actions {
    margin: 32px 0 16px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* Comments loaded under the quick-actions bar (single + AJAX Read More) */
.ac-ajax-comments {
    margin: 0 0 1em;
    clear: both;
    overflow: visible;
}
.ac-ajax-comments .ac-comments-bottom-spacer {
    width: 100%;
    pointer-events: none;
}
/* Keep the main comment field + Post Comment foot visible (wpDiscuz collapsed form) */
.ac-ajax-comments .wpd-form-wrap,
.ac-ajax-comments .wpdiscuz-textarea-wrap,
.ac-ajax-comments .wpd-textarea-wrap {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
}
.ac-ajax-comments .wpd-form-wrap {
    scroll-margin-top: 12px;
    scroll-margin-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
.ac-ajax-comments .wpd_comm_form .wpd-form-foot {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    max-height: none !important;
}
/* Hide Quill toolbar until the user focuses/clicks the comment field. */
#wpdcom .ql-toolbar.ac-quill-toolbar-deferred,
#wpdcom [id^="wpd-editor-toolbar-"].ac-quill-toolbar-deferred,
.ac-ajax-comments .ql-toolbar.ac-quill-toolbar-deferred,
.ac-ajax-comments [id^="wpd-editor-toolbar-"].ac-quill-toolbar-deferred {
    display: none !important;
}
/* Revealed toolbar — beat wpDiscuz .wpd-toolbar-hidden and inline hides on mobile. */
#wpdcom .ql-toolbar:not(.ac-quill-toolbar-deferred),
#wpdcom [id^="wpd-editor-toolbar-"]:not(.ac-quill-toolbar-deferred),
.ac-ajax-comments .ql-toolbar:not(.ac-quill-toolbar-deferred),
.ac-ajax-comments [id^="wpd-editor-toolbar-"]:not(.ac-quill-toolbar-deferred) {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: 28px !important;
    overflow: visible !important;
}
/* Toolbar normally supplies the editor's bottom edge — restore it while deferred. */
#wpdcom .ql-container:has(+ .ql-toolbar.ac-quill-toolbar-deferred),
#wpdcom .ql-container:has(+ [id^="wpd-editor-toolbar-"].ac-quill-toolbar-deferred),
.ac-ajax-comments .ql-container:has(+ .ql-toolbar.ac-quill-toolbar-deferred),
.ac-ajax-comments .ql-container:has(+ [id^="wpd-editor-toolbar-"].ac-quill-toolbar-deferred) {
    border-bottom: 1px solid #dddddd !important;
    border-radius: 3px !important;
}
/*
 * Quill toolbar buttons are plain <button> elements. Astra styles all `button`
 * with a solid theme background, which turns the toolbar into blue blocks
 * whenever wpDiscuz combo CSS loads late or loses specificity (AJAX comments).
 */
#wpdcom .ql-toolbar.ql-snow button,
#wpdcom .ql-snow .ql-toolbar button,
#wpdcom [id^="wpd-editor-toolbar-"] button,
.ac-ajax-comments .ql-toolbar button,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #666 !important;
    min-width: 28px !important;
    width: 28px !important;
    min-height: 24px !important;
    height: 24px !important;
    padding: 3px 5px !important;
    margin: 0 1px !important;
    line-height: 1 !important;
    border-radius: 0 !important;
    text-shadow: none !important;
}
#wpdcom .ql-toolbar button svg,
#wpdcom [id^="wpd-editor-toolbar-"] button svg,
.ac-ajax-comments .ql-toolbar button svg,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button svg {
    display: block !important;
    float: none !important;
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
}
#wpdcom .ql-toolbar .ql-stroke,
#wpdcom [id^="wpd-editor-toolbar-"] .ql-stroke,
.ac-ajax-comments .ql-toolbar .ql-stroke,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] .ql-stroke {
    fill: none !important;
    stroke: #999999 !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}
#wpdcom .ql-toolbar .ql-fill,
#wpdcom .ql-toolbar .ql-stroke.ql-fill,
#wpdcom [id^="wpd-editor-toolbar-"] .ql-fill,
.ac-ajax-comments .ql-toolbar .ql-fill,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] .ql-fill {
    fill: #999999 !important;
    stroke: none !important;
}
#wpdcom .ql-toolbar button:hover .ql-stroke,
#wpdcom .ql-toolbar button.ql-active .ql-stroke,
#wpdcom [id^="wpd-editor-toolbar-"] button:hover .ql-stroke,
#wpdcom [id^="wpd-editor-toolbar-"] button.ql-active .ql-stroke,
.ac-ajax-comments .ql-toolbar button:hover .ql-stroke,
.ac-ajax-comments .ql-toolbar button.ql-active .ql-stroke,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button:hover .ql-stroke,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button.ql-active .ql-stroke {
    stroke: #0274be !important;
}
#wpdcom .ql-toolbar button:hover .ql-fill,
#wpdcom .ql-toolbar button.ql-active .ql-fill,
#wpdcom [id^="wpd-editor-toolbar-"] button:hover .ql-fill,
#wpdcom [id^="wpd-editor-toolbar-"] button.ql-active .ql-fill,
.ac-ajax-comments .ql-toolbar button:hover .ql-fill,
.ac-ajax-comments .ql-toolbar button.ql-active .ql-fill,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button:hover .ql-fill,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button.ql-active .ql-fill {
    fill: #0274be !important;
}
#wpdcom .ql-toolbar button.ql-spoiler,
#wpdcom .ql-toolbar button.ql-sourcecode,
#wpdcom [id^="wpd-editor-toolbar-"] button.ql-spoiler,
#wpdcom [id^="wpd-editor-toolbar-"] button.ql-sourcecode,
.ac-ajax-comments .ql-toolbar button.ql-spoiler,
.ac-ajax-comments .ql-toolbar button.ql-sourcecode,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button.ql-spoiler,
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button.ql-sourcecode {
    width: auto !important;
    min-width: 0 !important;
    color: #999999 !important;
    font-size: 13px !important;
    line-height: 24px !important;
}
.ac-ajax-comments [id^="wpd-editor-toolbar-"] button:empty {
    min-width: 28px !important;
    min-height: 24px !important;
}
/* Quill keeps a hidden textarea.wc_comment for FormData — never show it or
   users see raw HTML like <p><br></p> after sync on Post Comment. */
.ac-ajax-comments form.wpd_comm_form:has(.ql-editor) textarea.wc_comment {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
/* Mobile / no_quill: no .ql-editor — show the real textarea */
.ac-ajax-comments form.wpd_comm_form:not(:has(.ql-editor)) textarea.wc_comment {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 54px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
/* Don't leave a tall empty frame under "0 Comments".
 * Must beat #wpdcom .wpd-thread-list { padding: 30px 0 } and #comments { margin: 50px auto }. */
.ac-ajax-comments #comments {
    margin: 0 auto 4px !important;
    max-width: none;
}
.ac-ajax-comments #wpdcom {
    margin: 0 auto 4px !important;
}
.ac-ajax-comments #wpdcom .wpd-thread-list {
    padding: 8px 0 !important;
    min-height: 0 !important;
}
.ac-ajax-comments #wpdcom .wpd-thread-list:not(:has(.wpd-comment)) {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
}
.ac-ajax-comments #wpdcom .wpd-thread-list:not(:has(.wpd-comment)) .wpdiscuz-comment-pagination,
.ac-ajax-comments #wpdcom .wpd-thread-list:not(:has(.wpd-comment)) .wpd-load-more-submit-wrap {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.ac-comments-deferred[hidden] {
    display: none !important;
}
.ac-comments-loading {
    margin: 16px 0;
    padding: 12px 16px;
    text-align: center;
    color: #64748b;
    font-style: italic;
}
.ac-comments-loading--error {
    color: #b91c1c;
    font-style: normal;
}
.ac-chatbot-actions-heading {
    width: 100%;
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}
.ac-chatbot-actions .ac-chatbot-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1.2;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    white-space: nowrap;
}
@media (min-width: 922px) {
    .ac-chatbot-actions {
        flex-wrap: nowrap;
        gap: 6px;
        padding: 12px;
    }
    .ac-chatbot-actions .ac-chatbot-action {
        gap: 4px;
        padding: 6px 10px;
        font-size: 12px;
    }
    .ac-chatbot-actions .ac-chatbot-action-icon svg {
        width: 14px;
        height: 14px;
    }
}
.ac-chatbot-action-icon {
    display: inline-flex;
    flex-shrink: 0;
    line-height: 0;
    color: #475569;
}
.ac-chatbot-action-icon svg {
    display: block;
}
.ac-chatbot-actions .ac-chatbot-action:hover .ac-chatbot-action-icon {
    color: #2563eb;
}
.ac-chatbot-actions .ac-chatbot-action:hover {
    background: #eef2ff;
    border-color: #93c5fd;
}
.ac-chatbot-actions .ac-chatbot-action:active {
    transform: translateY(1px);
}

.ac-translate-menu {
    position: relative;
    display: inline-flex;
}
.ac-translate-panel {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    z-index: 40;
    width: min(260px, calc(100vw - 32px));
    max-height: 280px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    flex-direction: column;
    gap: 6px;
}
.ac-translate-menu.is-open .ac-translate-panel {
    display: flex;
}
.ac-translate-search {
    width: 100%;
    margin: 0;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.2;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #0f172a;
}
.ac-translate-search:focus {
    outline: none;
    border-color: #93c5fd;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}
.ac-translate-search.is-filtered-out,
.ac-translate-search[hidden] {
    display: none !important;
}
.ac-translate-options {
    overflow: auto;
    max-height: 210px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ac-translate-option {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    line-height: 1.2;
    color: #1f2937;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.ac-translate-option.is-filtered-out,
.ac-translate-option[hidden],
.ac-translate-empty.is-filtered-out,
.ac-translate-empty[hidden] {
    display: none !important;
}
.ac-translate-option:hover,
.ac-translate-option:focus,
.ac-translate-option.is-active {
    background: #eef2ff;
    color: #1d4ed8;
    outline: none;
}
.ac-translate-option.is-selected {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}
.ac-translate-option.is-selected.is-active {
    background: #bfdbfe;
}
.ac-translate-empty {
    display: block;
    margin: 0;
    padding: 8px 10px;
    font-size: 12px;
    color: #64748b;
}

@keyframes ac-chatbot-blink {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
    25%, 75% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.55); }
    50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.25); }
}
.ac-chatbot-blink,
.ac-chatbot-blink.mwai-window-box {
    animation: ac-chatbot-blink 1.2s ease-in-out;
}

/* Clickable inline backtick terms */
.entry-content .ac-backtick-ask,
.ac-ajax-content .ac-backtick-ask,
.entry-title .ac-backtick-ask,
h1.entry-title .ac-backtick-ask,
h2.entry-title .ac-backtick-ask,
.ast-excerpt-container .ac-backtick-ask,
#single-excerpt .ac-backtick-ask,
.ac-ai-excerpt-region .ac-backtick-ask {
    display: inline;
    position: relative;
    padding: 0 0.2em;
    border-radius: 3px;
    background: #eef2ff;
    color: #1e40af;
    border-bottom: 1px dashed #93c5fd;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%230084ff' stroke='%23ffffff' stroke-width='1.5' d='M5 3l10 21 3-7.5L25 12z'/%3E%3Ccircle cx='24' cy='7' r='5' fill='%23f59e0b' stroke='%23ffffff' stroke-width='1.5'/%3E%3C/svg%3E") 4 4, pointer !important;
    font-style: normal;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.entry-content .ac-backtick-ask[data-hover-label]::before,
.ac-ajax-content .ac-backtick-ask[data-hover-label]::before,
.entry-title .ac-backtick-ask[data-hover-label]::before,
h1.entry-title .ac-backtick-ask[data-hover-label]::before,
h2.entry-title .ac-backtick-ask[data-hover-label]::before,
.ast-excerpt-container .ac-backtick-ask[data-hover-label]::before,
#single-excerpt .ac-backtick-ask[data-hover-label]::before,
.ac-ai-excerpt-region .ac-backtick-ask[data-hover-label]::before {
    content: attr(data-hover-label);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    padding: 4px 8px;
    border-radius: 6px;
    background: #1f2937;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 10005;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}
.entry-content .ac-backtick-ask[data-hover-label]:hover::before,
.entry-content .ac-backtick-ask[data-hover-label]:focus-visible::before,
.ac-ajax-content .ac-backtick-ask[data-hover-label]:hover::before,
.ac-ajax-content .ac-backtick-ask[data-hover-label]:focus-visible::before,
.entry-title .ac-backtick-ask[data-hover-label]:hover::before,
.entry-title .ac-backtick-ask[data-hover-label]:focus-visible::before,
h1.entry-title .ac-backtick-ask[data-hover-label]:hover::before,
h1.entry-title .ac-backtick-ask[data-hover-label]:focus-visible::before,
h2.entry-title .ac-backtick-ask[data-hover-label]:hover::before,
h2.entry-title .ac-backtick-ask[data-hover-label]:focus-visible::before,
.ast-excerpt-container .ac-backtick-ask[data-hover-label]:hover::before,
.ast-excerpt-container .ac-backtick-ask[data-hover-label]:focus-visible::before,
#single-excerpt .ac-backtick-ask[data-hover-label]:hover::before,
#single-excerpt .ac-backtick-ask[data-hover-label]:focus-visible::before,
.ac-ai-excerpt-region .ac-backtick-ask[data-hover-label]:hover::before,
.ac-ai-excerpt-region .ac-backtick-ask[data-hover-label]:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.entry-content .ac-backtick-ask:hover,
.entry-content .ac-backtick-ask:focus,
.ac-ajax-content .ac-backtick-ask:hover,
.ac-ajax-content .ac-backtick-ask:focus,
.entry-title .ac-backtick-ask:hover,
.entry-title .ac-backtick-ask:focus,
h1.entry-title .ac-backtick-ask:hover,
h1.entry-title .ac-backtick-ask:focus,
h2.entry-title .ac-backtick-ask:hover,
h2.entry-title .ac-backtick-ask:focus,
.ast-excerpt-container .ac-backtick-ask:hover,
.ast-excerpt-container .ac-backtick-ask:focus,
#single-excerpt .ac-backtick-ask:hover,
#single-excerpt .ac-backtick-ask:focus,
.ac-ai-excerpt-region .ac-backtick-ask:hover,
.ac-ai-excerpt-region .ac-backtick-ask:focus {
    background: #dbeafe;
    color: #1d4ed8;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.35);
}
.entry-content .ac-backtick-ask.is-active,
.ac-ajax-content .ac-backtick-ask.is-active,
.entry-title .ac-backtick-ask.is-active,
h1.entry-title .ac-backtick-ask.is-active,
h2.entry-title .ac-backtick-ask.is-active,
.ast-excerpt-container .ac-backtick-ask.is-active,
#single-excerpt .ac-backtick-ask.is-active,
.ac-ai-excerpt-region .ac-backtick-ask.is-active {
    background: #bfdbfe;
}

/* Article text selection hint */
:root {
    --ac-ai-select-cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27118%27%20height%3D%2728%27%20viewBox%3D%270%200%20118%2028%27%3E%3Cpath%20fill%3D%27%23f59e0b%27%20stroke%3D%27%23ffffff%27%20stroke-width%3D%271.5%27%20d%3D%27M4%202l9%2019%203-7%2011-4z%27%2F%3E%3Crect%20x%3D%2726%27%20y%3D%274%27%20width%3D%2788%27%20height%3D%2720%27%20rx%3D%274%27%20fill%3D%27%23fff7ed%27%20stroke%3D%27%23f59e0b%27%20stroke-width%3D%271%27%2F%3E%3Ctext%20x%3D%2770%27%20y%3D%2714%27%20text-anchor%3D%27middle%27%20dominant-baseline%3D%27middle%27%20font-family%3D%27system-ui%2C-apple-system%2Csans-serif%27%20font-size%3D%2711%27%20font-weight%3D%27600%27%20fill%3D%27%23c2410c%27%3ESelect%20Text%3C%2Ftext%3E%3C%2Fsvg%3E") 4 2, text;
}
.ac-ai-selectable,
.ac-ai-selectable *:not(a):not(button):not(img):not(video):not(iframe):not(input):not(textarea):not(select):not(pre),
.ac-ai-selectable-chatbot,
.ac-ai-selectable-chatbot *:not(a):not(button):not(img):not(video):not(iframe):not(input):not(textarea):not(select) {
    cursor: var(--ac-ai-select-cursor);
}
.ac-ai-selectable,
.ac-ai-selectable p,
.ac-ai-selectable li,
.ac-ai-selectable td,
.ac-ai-selectable th,
.ac-ai-selectable blockquote,
.ac-ai-selectable h1,
.ac-ai-selectable h2,
.ac-ai-selectable h3,
.ac-ai-selectable h4,
.ac-ai-selectable h5,
.ac-ai-selectable h6,
.ac-ai-selectable-chatbot,
.ac-ai-selectable-chatbot p,
.ac-ai-selectable-chatbot li,
.ac-ai-selectable-chatbot pre,
.ac-ai-selectable-chatbot code,
.ac-ai-selectable-chatbot pre code,
.ac-ai-selectable-chatbot blockquote,
.ac-ai-selectable-chatbot h1,
.ac-ai-selectable-chatbot h2,
.ac-ai-selectable-chatbot h3,
.ac-ai-selectable-chatbot h4,
.ac-ai-selectable-chatbot h5,
.ac-ai-selectable-chatbot h6 {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}
.ac-ai-selectable .ac-backtick-ask,
.ac-ai-selectable .ac-backtick-ask:hover,
.ac-ai-selectable-chatbot .ac-backtick-ask,
.ac-ai-selectable-chatbot .ac-backtick-ask:hover {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%230084ff' stroke='%23ffffff' stroke-width='1.5' d='M5 3l10 21 3-7.5L25 12z'/%3E%3Ccircle cx='24' cy='7' r='5' fill='%23f59e0b' stroke='%23ffffff' stroke-width='1.5'/%3E%3C/svg%3E") 4 4, pointer !important;
}
.ac-ai-selectable-chatbot a {
    cursor: pointer;
}
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) img,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) video,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) iframe,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) pre,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) .ac-chatbot-actions,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) .ac-chatbot-actions *,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) .ac-ai-select-hint {
    cursor: auto;
}
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) .ac-chatbot-actions,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) .ac-chatbot-actions * {
    cursor: pointer;
}
/* Buttons/links must stay clickable (pointer), not I-beam from inherited select cursor. */
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) a,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) button,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) input[type="submit"],
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) input[type="button"],
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) .tnp-submit {
    cursor: pointer !important;
}
/* Linked media: Chrome uses the img's own cursor (auto), so restore the hand. */
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) a img,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) a video,
.ac-ai-selectable:not(.ac-ai-selectable-chatbot) a iframe {
    cursor: pointer !important;
}
/* Entry meta stays clickable — never show Select Text cursor there */
.entry-meta,
.entry-meta *,
.ac-ai-selectable .entry-meta,
.ac-ai-selectable .entry-meta *,
.ac-ai-selectable .ac-ai-author-badge {
    cursor: auto;
    -webkit-user-select: none;
    user-select: none;
}
.entry-meta a,
.entry-meta a *,
.ac-ai-selectable .entry-meta a,
.ac-ai-selectable .entry-meta a *,
.ac-ai-selectable .entry-meta .ac-ai-author-badge {
    cursor: pointer !important;
}
/* wpDiscuz Reply is a <div>, not <a>/<button> — exclude comments UI from Select Text */
.ac-ai-selectable .ac-ajax-comments,
.ac-ai-selectable .ac-ajax-comments *,
.ac-ai-selectable #wpdcom,
.ac-ai-selectable #wpdcom *,
.ac-ai-selectable #comments,
.ac-ai-selectable #comments * {
    cursor: auto;
}
.ac-ai-selectable .ac-ajax-comments a,
.ac-ai-selectable .ac-ajax-comments button,
.ac-ai-selectable .ac-ajax-comments .wpd-reply-button,
.ac-ai-selectable .ac-ajax-comments .wpd-reply-button *,
.ac-ai-selectable #wpdcom a,
.ac-ai-selectable #wpdcom button,
.ac-ai-selectable #wpdcom .wpd-reply-button,
.ac-ai-selectable #wpdcom .wpd-reply-button *,
.ac-ai-selectable #wpdcom .wpd-vote-up,
.ac-ai-selectable #wpdcom .wpd-vote-down,
.ac-ai-selectable #wpdcom .wpd-tools,
.ac-ai-selectable #wpdcom .wpd-tools *,
.ac-ai-selectable #wpdcom .wpd-comment-link,
.ac-ai-selectable #wpdcom .wpd-toggle,
.ac-ai-selectable #wpdcom .wpd-load-more-submit {
    cursor: pointer !important;
}
.ac-ai-selectable .ac-ajax-comments .ql-editor,
.ac-ai-selectable .ac-ajax-comments .ql-editor *,
.ac-ai-selectable #wpdcom .ql-editor,
.ac-ai-selectable #wpdcom .ql-editor *,
.ac-ai-selectable #wpdcom textarea.wc_comment {
    cursor: text !important;
}
.ac-ai-select-hint {
    margin: 0 0 16px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
}

.ac-select-chat-help-modal__body {
    margin: 0 0 20px;
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
}
.ac-select-chat-help-modal__body p {
    margin: 0 0 12px;
}
.ac-select-chat-help-modal__body ul {
    margin: 0 0 12px;
    padding-left: 1.25em;
}
.ac-select-chat-help-modal__body li {
    margin: 0 0 8px;
}
.ac-select-chat-help-modal .ac-backtick-ask-modal__actions {
    justify-content: flex-end;
}

body.ac-backtick-ask-open {
    overflow: hidden;
}
.ac-backtick-ask-modal {
    position: fixed;
    inset: 0;
    /* Above AI Engine fullscreen chatbot (999999). */
    z-index: 10001000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ac-backtick-ask-modal[hidden] {
    display: none !important;
}
.ac-backtick-ask-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}
.ac-backtick-ask-modal__dialog {
    position: relative;
    width: min(100%, 720px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    padding: 24px;
    padding-top: 28px;
}
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    margin: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    z-index: 2;
}
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:before,
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:after {
    content: " ";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.2px;
    height: 18px;
    margin-top: -9px;
    margin-left: -0.6px;
    background-color: #64748b;
    transition: transform 0.2s ease-out, background-color 0.2s ease-out;
}
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:before {
    transform: rotate(45deg);
}
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:after {
    transform: rotate(-45deg);
}
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:hover:before,
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:focus-visible:before {
    transform: rotate(135deg);
    background-color: #0f172a;
}
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:hover:after,
.ac-backtick-ask-modal__dialog .mwai-close-button.ac-backtick-ask-modal__close:focus-visible:after {
    transform: rotate(45deg);
    background-color: #0f172a;
}
.ac-backtick-ask-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
}
.ac-backtick-ask-modal__close:hover,
.ac-backtick-ask-modal__close:focus {
    color: #0f172a;
}
.ac-backtick-ask-modal__title {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.3;
    color: #0f172a;
}
.ac-backtick-ask-modal__selected {
    margin: 0 0 16px;
    font-size: 14px;
    color: #475569;
}
.ac-backtick-ask-modal__term {
    display: inline;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    color: #0f172a;
}
.ac-backtick-ask-modal__term--multiline {
    display: block;
    margin: 6px 0 0;
    max-height: 96px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
}
.ac-backtick-ask-modal__field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
    min-height: 84px;
}
.ac-backtick-ask-modal__field textarea:focus {
    border-color: #0084ff;
    outline: 2px solid rgba(0, 132, 255, 0.2);
    outline-offset: 0;
}
.ac-backtick-ask-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    align-items: center;
}
@media (min-width: 768px) {
    .ac-backtick-ask-modal__actions {
        flex-wrap: nowrap;
    }
}
.ac-backtick-ask-modal__preset,
.ac-backtick-ask-modal__copy,
.ac-backtick-ask-modal__send {
    border-radius: 16px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #fff !important;
    color: #1f2937 !important;
    box-shadow: none !important;
    white-space: nowrap;
    flex: 0 0 auto;
}
.ac-backtick-ask-modal__preset:hover,
.ac-backtick-ask-modal__preset:focus,
.ac-backtick-ask-modal__copy:hover,
.ac-backtick-ask-modal__copy:focus {
    background: #dbeafe !important;
    border-color: #60a5fa !important;
    color: #1e3a8a !important;
}
.ac-backtick-ask-modal__copy[hidden] {
    display: none !important;
}
.ac-backtick-ask-modal__translate-menu {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}
.ac-backtick-ask-modal .ac-translate-panel {
    top: calc(100% + 6px);
    bottom: auto;
    left: 0;
    transform: none;
    z-index: 50;
}
.ac-backtick-ask-modal__send {
    margin-left: auto;
    background: #0084ff !important;
    border-color: #0084ff !important;
    color: #fff !important;
}
.ac-backtick-ask-modal__send:hover,
.ac-backtick-ask-modal__send:focus {
    background: #006fd6 !important;
    border-color: #006fd6 !important;
    color: #fff !important;
}

/* Floating "Ask AI" chip for touch / coarse-pointer text selection */
.ac-ai-selection-chip {
    position: fixed;
    /* Above AI Engine fullscreen chatbot (999999). */
    z-index: 10001000;
    margin: 0;
    padding: 0.45rem 0.85rem;
    border: 1px solid #0084ff;
    border-radius: 999px;
    background: #0084ff;
    color: #fff;
    font: 600 0.8125rem/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(0, 132, 255, 0.35);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.ac-ai-selection-chip[hidden] {
    display: none !important;
}
.ac-ai-selection-chip:hover,
.ac-ai-selection-chip:focus-visible {
    background: #006fd6;
    border-color: #006fd6;
    outline: none;
}

/* Inline code in user chat bubbles (backtick-selected terms) */
#mwai-chatbot-popbot .mwai-reply.mwai-user .mwai-text code,
.mwai-window#mwai-chatbot-popbot .mwai-reply.mwai-user .mwai-text code,
.mwai-popbot-theme .mwai-reply.mwai-user .mwai-text code {
    display: inline;
    padding: 0.1em 0.45em;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92) !important;
    color: #0f172a !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.92em;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.65);
}

/* Hide the original floating triggers — proxied by the bar above */
#ast-scroll-top { display: none !important; }
#mwai-chatbot-popbot .mwai-open-button {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    pointer-events: auto;
}

.mwai-popbot-theme .mwai-text h1, .mwai-popbot-theme .mwai-text h2, .mwai-popbot-theme .mwai-text h3, .mwai-popbot-theme .mwai-text h4, .mwai-popbot-theme .mwai-text h5, .mwai-popbot-theme .mwai-text h6 {
    margin: 25px 0;
}

/* Match site list styles (style.css › markers) inside chat replies */
#mwai-chatbot-popbot .mwai-text ol,
#mwai-chatbot-popbot .mwai-text ul,
.mwai-popbot-theme .mwai-text ol,
.mwai-popbot-theme .mwai-text ul {
    margin: 8px 0 4px !important;
    overflow: visible;
}

#mwai-chatbot-popbot .mwai-text ul,
.mwai-popbot-theme .mwai-text ul {
    margin-left: 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
}

#mwai-chatbot-popbot .mwai-text ol,
.mwai-popbot-theme .mwai-text ol {
    padding-left: 1.5em !important;
    margin-left: 16px !important;
}

#mwai-chatbot-popbot .mwai-text ol ol,
#mwai-chatbot-popbot .mwai-text ol ul,
#mwai-chatbot-popbot .mwai-text ul ol,
#mwai-chatbot-popbot .mwai-text ul ul,
.mwai-popbot-theme .mwai-text ol ol,
.mwai-popbot-theme .mwai-text ol ul,
.mwai-popbot-theme .mwai-text ul ol,
.mwai-popbot-theme .mwai-text ul ul {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#mwai-chatbot-popbot .mwai-text ul + ul,
.mwai-popbot-theme .mwai-text ul + ul {
    margin-top: 0 !important;
}

#mwai-chatbot-popbot .mwai-text ul li,
.mwai-popbot-theme .mwai-text ul li {
    list-style: none !important;
    padding: 1px 1px 1px 16px !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    position: relative !important;
    overflow: visible !important;
}

#mwai-chatbot-popbot .mwai-text ul li p,
#mwai-chatbot-popbot .mwai-text ul li > *,
.mwai-popbot-theme .mwai-text ul li p,
.mwai-popbot-theme .mwai-text ul li > * {
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#mwai-chatbot-popbot .mwai-text ul li::before,
.mwai-popbot-theme .mwai-text ul li::before {
    content: "›" !important;
    position: absolute !important;
    left: 2px !important;
    top: 2px !important;
    color: #5a9fd4 !important;
    font-weight: bold !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    display: inline-block !important;
}

#mwai-chatbot-popbot .mwai-text ul li a,
.mwai-popbot-theme .mwai-text ul li a {
    color: #367bb7 !important;
    font-size: 16px;
    text-decoration: none !important;
}

#mwai-chatbot-popbot .mwai-text ul li a:hover,
.mwai-popbot-theme .mwai-text ul li a:hover {
    text-decoration: underline;
    color: #1a5a9a !important;
}

/* Compact source-like paragraphs while HTML lists are still streaming in */
#mwai-chatbot-popbot .mwai-text p:has(> a:only-child),
.mwai-popbot-theme .mwai-text p:has(> a:only-child) {
    margin: 0.15em 0 !important;
}

#mwai-chatbot-popbot .mwai-text ol li,
.mwai-popbot-theme .mwai-text ol li {
    list-style: decimal !important;
    list-style-position: outside !important;
    display: list-item !important;
    padding: 1px 1px 1px 0 !important;
    line-height: 1.35 !important;
    margin: 0 0 2px !important;
    position: static !important;
    overflow: visible !important;
}

#mwai-chatbot-popbot .mwai-text ol li::before,
.mwai-popbot-theme .mwai-text ol li::before {
    content: none !important;
    display: none !important;
}

#mwai-chatbot-popbot .mwai-text ol li::marker,
.mwai-popbot-theme .mwai-text ol li::marker {
    color: #5a9fd4;
    font-weight: bold;
}

.mwai-popbot-theme.mwai-window:not(.ac-panel-positioned) .mwai-conversation {
	max-height: 1000px !important;
}

.mwai-popbot-theme .mwai-text p,
.mwai-popbot-theme .mwai-conversation .mwai-reply,
.mwai-popbot-theme .mwai-input .mwai-input-text textarea,
#mwai-chatbot-popbot .mwai-input .mwai-input-text textarea {
	font-size: 15px !important;
}

/* Translated article screenshots: center image + caption, tight gap */
#mwai-chatbot-popbot .mwai-text img,
.mwai-popbot-theme .mwai-text img {
	display: block;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
	max-width: min(600px, 100%);
	height: auto;
}

#mwai-chatbot-popbot .mwai-text figure,
.mwai-popbot-theme .mwai-text figure {
	display: block;
	margin: 0.75em auto;
	max-width: min(600px, 100%);
	width: 100%;
	text-align: center;
}

#mwai-chatbot-popbot .mwai-text figure img,
.mwai-popbot-theme .mwai-text figure img {
	margin-top: 0;
	margin-bottom: 0;
	width: 100%;
}

#mwai-chatbot-popbot .mwai-text figure figcaption,
.mwai-popbot-theme .mwai-text figure figcaption {
	margin: 0.35em 0 0;
	font-style: italic;
}

#mwai-chatbot-popbot .mwai-text p:has(> img),
#mwai-chatbot-popbot .mwai-text p:has(> a > img),
.mwai-popbot-theme .mwai-text p:has(> img),
.mwai-popbot-theme .mwai-text p:has(> a > img) {
	margin-bottom: 0.25em;
	text-align: center;
}

#mwai-chatbot-popbot .mwai-text p:has(> img) + p,
#mwai-chatbot-popbot .mwai-text p:has(> a > img) + p,
.mwai-popbot-theme .mwai-text p:has(> img) + p,
.mwai-popbot-theme .mwai-text p:has(> a > img) + p {
	margin-top: 0.25em;
	text-align: center;
}

@media only screen and (max-width: 925px) {

  .mwai-popbot-theme .mwai-trigger {
    right: -21px !important;
    margin-left: 10px;
    width: 42px;
  }

  .ast-scroll-to-top-right {
    right: 5px !important;
    width: 20px !important; 

  }
}

/* Chat history sidebar (mwai_discussions) beside the site-wide popup */
.ac-chatbot-history {
  display: none;
  position: fixed;
  z-index: 9998;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: var(--mwai-borderRadius, 10px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  background: var(--mwai-conversationsBackgroundColor, #ffffff);
}

.ac-chatbot-history__close {
  position: absolute !important;
  top: 50%;
  right: 1rem;
  left: auto;
  margin: 0;
  transform: translateY(-50%);
  z-index: 12;
}

.ac-chatbot-history .mwai-header > .ac-chatbot-history__close::before,
.ac-chatbot-history .mwai-header > .ac-chatbot-history__close::after {
  background-color: rgba(255, 255, 255, 0.92);
}

.ac-chatbot-history .mwai-header > .ac-chatbot-history__close:hover::before,
.ac-chatbot-history .mwai-header > .ac-chatbot-history__close:focus-visible::before {
  transform: rotate(135deg);
}

.ac-chatbot-history .mwai-header > .ac-chatbot-history__close:hover::after,
.ac-chatbot-history .mwai-header > .ac-chatbot-history__close:focus-visible::after {
  transform: rotate(45deg);
}

.ac-chatbot-history #mwai-discussions-popbot .mwai-header,
.ac-chatbot-history .mwai-discussions .mwai-header {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-right: calc(1rem + 32px);
}

/* Match NEW button styles from the mwai theme (.mwai-header button). */
.ac-chatbot-history .ac-history-clear-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Clear-history warning dialog */
.ac-history-clear-modal {
  position: fixed;
  inset: 0;
  z-index: 1000010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ac-history-clear-modal.is-open {
  display: flex;
}

.ac-history-clear-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ac-history-clear-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  padding: 20px 22px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  border: 1px solid #e2e8f0;
}

.ac-history-clear-modal__message {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.4;
  color: #111;
  font-weight: 600;
}

.ac-history-clear-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.ac-history-clear-modal__btn {
  min-width: 72px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #94a3b8;
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.ac-history-clear-modal__btn--yes {
  background: linear-gradient(130deg, #2831dc 0%, #09a9f8 100%) !important;
  border-color: #1d4ed8 !important;
  color: #fff !important;
}

.ac-history-clear-modal__btn--yes:hover,
.ac-history-clear-modal__btn--yes:focus-visible {
  filter: brightness(1.12);
  box-shadow: 0 0 0 3px rgba(40, 49, 220, 0.35);
}

.ac-history-clear-modal__btn--no {
  background: #e2e8f0 !important;
  border-color: #64748b !important;
  color: #0f172a !important;
}

.ac-history-clear-modal__btn--no:hover,
.ac-history-clear-modal__btn--no:focus-visible {
  background: #cbd5e1 !important;
  border-color: #334155 !important;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.35);
}

.ac-chatbot-history #mwai-discussions-popbot .mwai-content,
.ac-chatbot-history #mwai-discussions-popbot .mwai-body,
.ac-chatbot-history .mwai-discussions .mwai-body {
  background: var(--mwai-conversationsBackgroundColor, #ffffff) !important;
}

.ac-chatbot-history.is-visible {
  display: block;
}

.ac-chatbot-history .mwai-discussions-container {
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  float: none !important;
  border: none;
  border-radius: 0;
}

.ac-chatbot-history #mwai-discussions-popbot {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ac-chatbot-history #mwai-discussions-popbot .mwai-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ac-chatbot-history #mwai-discussions-popbot .mwai-content ul {
  min-height: 0;
}

.ac-chatbot-history #mwai-discussions-popbot .mwai-pagination {
  flex: 0 0 auto;
  margin-top: auto;
  box-sizing: border-box;
}

.ac-chatbot-history #mwai-discussions-popbot .mwai-pagination span,
.ac-chatbot-history #mwai-discussions-popbot .mwai-pagination .mwai-page-indicator {
  color: var(--mwai-fontColor, #111) !important;
  opacity: 1 !important;
}

.ac-chatbot-history .mwai-discussions .mwai-discussion {
  position: relative !important;
}

.ac-chatbot-history .mwai-discussions .mwai-discussion .mwai-discussion-actions {
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.2s ease-out;
}

.ac-chatbot-history .mwai-discussions .mwai-discussion:hover .mwai-discussion-actions,
.ac-chatbot-history .mwai-discussions .mwai-discussion:has(.mwai-context-menu) .mwai-discussion-actions {
  opacity: 1;
}

/* Undo global entry list markers (ul li::before in this theme) */
.ac-chatbot-history ul,
.ac-chatbot-history ol {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.ac-chatbot-history ul li,
.ac-chatbot-history ol li {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  position: static !important;
  overflow: visible !important;
}

.ac-chatbot-history ul li::before,
.ac-chatbot-history ol li::before {
  content: none !important;
  display: none !important;
}

.ac-chatbot-history .mwai-discussion {
  padding-left: 10px !important;
  padding-right: 10px !important;
}

.ac-chatbot-history .mwai-discussion .mwai-discussion-content {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
}

.ac-chatbot-history .mwai-discussion .mwai-discussion-actions {
  right: 10px !important;
}

/* History left, model name truly centered, window controls right */
.mwai-window#mwai-chatbot-popbot.mwai-open .mwai-header,
#mwai-chatbot-popbot.mwai-window.mwai-open .mwai-header {
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  column-gap: 8px;
  min-height: 32px;
  padding: 0 0 0 15px;
  overflow: visible;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-chatbot-header-center,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-chatbot-header-center {
  /* Insets are set by JS so the name stays between History and Web with a gap. */
  position: absolute;
  left: 72px;
  right: 120px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

/* Guests (no History control): keep model name centered the same way */
.mwai-window#mwai-chatbot-popbot .mwai-header:not(:has(.ac-history-toggle)) .ac-chatbot-header-center,
#mwai-chatbot-popbot.mwai-window .mwai-header:not(:has(.ac-history-toggle)) .ac-chatbot-header-center {
  grid-column: auto;
  left: 12px;
}

/* Match History / Web header labels: 11px / 400, centered in the bar */
.mwai-window#mwai-chatbot-popbot .mwai-header .ac-chatbot-header-model,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-chatbot-header-model {
  color: var(--mwai-headerColor, #fff) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
  text-align: center;
}

/* Hide model name only when the panel is narrower than the original sidebar strip. */
.mwai-window#mwai-chatbot-popbot.ac-header-compact .mwai-header .ac-chatbot-header-model,
#mwai-chatbot-popbot.mwai-window.ac-header-compact .mwai-header .ac-chatbot-header-model {
  display: none !important;
}

.mwai-window#mwai-chatbot-popbot.ac-header-compact .mwai-header .ac-chatbot-header-center,
#mwai-chatbot-popbot.mwai-window.ac-header-compact .mwai-header .ac-chatbot-header-center {
  max-width: 0;
  overflow: hidden;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-buttons,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-buttons {
  grid-column: 3;
  margin-left: 0;
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  overflow: visible;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  grid-column: 1;
  justify-self: start;
  justify-content: flex-start;
  height: 32px;
  width: auto;
  min-width: 32px;
  gap: 5px;
  padding: 0 4px;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  border: none;
  background: transparent;
  margin: 0;
  color: var(--mwai-headerColor, #fff);
  z-index: 2;
  opacity: 0.45;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle .ac-history-toggle-label,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle .ac-history-toggle-label {
  font-size: 11px !important;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle .ac-history-toggle-icon,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle .ac-history-toggle-icon {
  display: block;
  pointer-events: none;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle:hover,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle:hover {
  opacity: 0.65;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle.is-off,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle.is-off {
  opacity: 1;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle.is-off .ac-history-toggle-icon rect,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle.is-off .ac-history-toggle-icon rect {
  fill: currentColor;
  fill-opacity: 0.22;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle.is-off:hover,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle.is-off:hover {
  opacity: 1;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  width: auto;
  min-width: 32px;
  margin: 0;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: var(--mwai-headerColor, #fff);
  cursor: pointer;
  opacity: 0.45;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle .ac-sources-toggle-label,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle .ac-sources-toggle-label {
  font-size: 11px !important;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle .ac-sources-toggle-icon,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle .ac-sources-toggle-icon {
  display: block;
  pointer-events: none;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle:hover,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle:hover {
  opacity: 0.65;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle.is-off,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle.is-off {
  opacity: 1;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle.is-off .ac-sources-toggle-icon circle,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle.is-off .ac-sources-toggle-icon ellipse,
.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle.is-off .ac-sources-toggle-icon line,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle.is-off .ac-sources-toggle-icon line {
  stroke-width: 2.2;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle.is-off:hover,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle.is-off:hover {
  opacity: 1;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore {
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--mwai-headerColor, #fff);
  cursor: pointer;
  opacity: 0.85;
  overflow: visible;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore:not([hidden]),
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore:not([hidden]) {
  display: flex !important;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore[hidden],
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore[hidden] {
  display: none !important;
}

/* Explicit tip element — reliable vs ::before clipping */
#mwai-chatbot-popbot .ac-sidebar-restore .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore .ac-hover-tip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f2937;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 100050;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

#mwai-chatbot-popbot .ac-sidebar-restore--header .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--header .ac-hover-tip {
  top: calc(100% + 8px);
  bottom: auto;
}

#mwai-chatbot-popbot .ac-sidebar-restore--footer .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--footer .ac-hover-tip {
  bottom: calc(100% + 8px);
  top: auto;
  transform: translateX(-50%) translateY(-4px);
}

#mwai-chatbot-popbot .ac-sidebar-restore:hover .ac-hover-tip,
#mwai-chatbot-popbot .ac-sidebar-restore:focus-visible .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore:hover .ac-hover-tip,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore:focus-visible .ac-hover-tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore[data-hover-label]::before,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore[data-hover-label]::before {
  content: none;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore:hover,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore:hover,
.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore:focus-visible,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore:focus-visible {
  opacity: 1;
  outline: none;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .ac-sidebar-restore .ac-sidebar-restore-icon,
#mwai-chatbot-popbot.mwai-window .mwai-header .ac-sidebar-restore .ac-sidebar-restore-icon {
  display: block;
  pointer-events: none;
}

/* Maximize / restore window control (AI Engine uses ::before for the icon) */
.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-resize-button,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-resize-button {
  position: relative;
  overflow: visible;
}

.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-resize-button[data-hover-label]::after,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-resize-button[data-hover-label]::after {
  content: attr(data-hover-label);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f2937;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 10005;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-resize-button[data-hover-label]:hover::after,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-resize-button[data-hover-label]:hover::after,
.mwai-window#mwai-chatbot-popbot .mwai-header .mwai-resize-button[data-hover-label]:focus-visible::after,
#mwai-chatbot-popbot.mwai-window .mwai-header .mwai-resize-button[data-hover-label]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

#mwai-chatbot-popbot .ac-sidebar-restore--footer,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--footer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  overflow: visible;
}

#mwai-chatbot-popbot .ac-sidebar-restore--footer:hover,
#mwai-chatbot-popbot .ac-sidebar-restore--footer:focus,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--footer:hover,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--footer:focus {
  background: #eef6ff;
  border-color: #93c5fd;
  color: var(--mwai-backgroundHeaderColor, #0084ff);
  outline: none;
}

#mwai-chatbot-popbot .ac-sidebar-restore--footer .ac-sidebar-restore-icon,
.mwai-window#mwai-chatbot-popbot .ac-sidebar-restore--footer .ac-sidebar-restore-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.ac-chatbot-history.is-fullscreen {
  z-index: 1000001;
  border-radius: 0;
  border-left: none;
  border-top: none;
  border-bottom: none;
}

/* Make room for history when chatbot is maximized */
.mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open.ac-with-history,
#mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open.ac-with-history {
  left: 268px !important;
  width: calc(100% - 268px) !important;
  max-width: calc(100% - 268px) !important;
}

/* Shared side-panel theme tokens (match mwai timeless discussions) */
.ac-chatbot-history,
.ac-chatbot-sources,
.ac-chatbot-ai-settings {
  --mwai-conversationsBackgroundColor: #ffffff;
  --mwai-backgroundPrimaryColor: #fafafa;
  --mwai-backgroundAiColor: #f1f3f7;
  --mwai-fontColor: #000000;
  --mwai-borderRadius: 10px;
  --mwai-spacing: 12px;
  --mwai-fontSize: 13px;
  --mwai-headerColor: #ffffff;
  --mwai-backgroundHeaderColor: linear-gradient(130deg, #2831dc 0%, #09a9f8 100%);
}

/* AI settings sidebar (AJAX panel) — width matches .mpi on the AI settings page (40rem). */
.ac-chatbot-ai-settings {
  display: none;
  position: fixed;
  z-index: 1000002;
  overflow: hidden;
  box-sizing: border-box;
  width: min(40rem, calc(100vw - 2rem));
  max-width: min(40rem, calc(100vw - 2rem));
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 var(--mwai-borderRadius, 10px) var(--mwai-borderRadius, 10px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  background: var(--mwai-conversationsBackgroundColor, #fff);
  flex-direction: column;
}

.ac-chatbot-ai-settings.is-visible {
  display: flex;
  flex-direction: column;
}

.ac-chatbot-ai-settings__header {
  flex: 0 0 auto;
}

.ac-chatbot-ai-settings__header.ac-chatbot-side-panel__header {
  position: relative;
  box-sizing: border-box;
  min-height: 48px;
  height: auto;
  max-height: none;
  display: flex;
  align-items: center;
  background: var(--mwai-backgroundHeaderColor);
  color: var(--mwai-headerColor);
  padding: 12px 48px 12px 16px;
  border-bottom: none;
}

.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__title {
  color: var(--mwai-headerColor);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
  margin: 0;
}

.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close {
  position: absolute !important;
  top: 50%;
  right: 12px;
  left: auto;
  transform: translateY(-50%);
  z-index: 12;
}

.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close::before,
.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close::after,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close::before,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close::after {
  background-color: rgba(255, 255, 255, 0.92);
}

.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close:hover::before,
.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close:hover::after,
.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close:focus-visible::before,
.ac-chatbot-ai-settings__header .ac-chatbot-side-panel__close:focus-visible::after,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:hover::before,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:hover::after,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:focus-visible::before,
.ac-chatbot-ai-settings__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:focus-visible::after {
  background-color: #ffffff;
}

.ac-chatbot-ai-settings__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px 28px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.ac-chatbot-ai-settings__loading {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
}

/* Fixed under header — always visible, independent of body scroll. */
.ac-chatbot-ai-settings__status {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  box-sizing: border-box;
}

.ac-chatbot-ai-settings__status[hidden] {
  display: none !important;
}

.ac-chatbot-ai-settings__status:not(.is-error) {
  color: #15803d;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  background: #f0fdf4;
  border-bottom-color: #bbf7d0;
}

.ac-chatbot-ai-settings__status.is-error {
  color: #b91c1c;
  background: #fef2f2;
  border-bottom-color: #fecaca;
}

.ac-chatbot-ai-settings .mpi-ai-settings-panel__form-wrap,
.ac-chatbot-ai-settings .mpi {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  box-sizing: border-box;
}

.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-ai-control,
.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-ai-control--model,
.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-ai-control--provider,
.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-ai-control--instructions,
.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-custom-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-ai-kb-list {
  max-height: min(280px, 40vh);
  padding-bottom: 6px;
  box-sizing: border-box;
}

/* Single 4sysops option (e.g. Perplexity): do not clip the description. */
.ac-chatbot-ai-settings .mpi-ai-knowledge-bases-field--embeddings-only .mpi-ai-kb-list {
  max-height: none;
  overflow: visible;
  padding-bottom: 8px;
}

.ac-chatbot-ai-settings .mpi-form--ai-chatbot .mpi-ai-kb-option-description {
  line-height: 1.45;
  padding-bottom: 0.15em;
}

.ac-chatbot-ai-settings .mpi-ai-knowledge-bases-field {
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.ac-chatbot-ai-settings .tnp-personal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 16px 0 0;
  padding: 16px 0 24px;
  background: #fff;
  box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.95);
}

.ac-chatbot-ai-settings .tnp-personal-actions .tnp-submit {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .ac-chatbot-ai-settings {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  .ac-chatbot-ai-settings__header.ac-chatbot-side-panel__header {
    padding: 10px 44px 10px 12px;
  }

  .ac-chatbot-ai-settings__body {
    padding: 10px 12px 28px;
  }
}

/* Web search sources sidebar on the right */
.ac-chatbot-sources {
  display: none;
  position: fixed;
  z-index: 9998;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: var(--mwai-borderRadius, 10px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  background: var(--mwai-conversationsBackgroundColor);
}

.ac-chatbot-sources.is-visible {
  display: flex;
  flex-direction: column;
}

.ac-chatbot-sources__header {
  flex: 0 0 auto;
}

.ac-chatbot-sources__header.ac-chatbot-side-panel__header {
  position: relative;
  box-sizing: border-box;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  background: var(--mwai-backgroundHeaderColor);
  color: var(--mwai-headerColor);
  padding: 0 0 0 15px;
  padding-right: calc(1rem + 32px);
}

.ac-chatbot-sources__header .ac-chatbot-side-panel__close::before,
.ac-chatbot-sources__header .ac-chatbot-side-panel__close::after,
.ac-chatbot-sources__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close::before,
.ac-chatbot-sources__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close::after {
  background-color: rgba(255, 255, 255, 0.92);
}

.ac-chatbot-sources__header .ac-chatbot-side-panel__close:hover::before,
.ac-chatbot-sources__header .ac-chatbot-side-panel__close:hover::after,
.ac-chatbot-sources__header .ac-chatbot-side-panel__close:focus-visible::before,
.ac-chatbot-sources__header .ac-chatbot-side-panel__close:focus-visible::after,
.ac-chatbot-sources__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:hover::before,
.ac-chatbot-sources__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:hover::after,
.ac-chatbot-sources__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:focus-visible::before,
.ac-chatbot-sources__header .mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:focus-visible::after {
  background-color: #ffffff;
}

.ac-chatbot-side-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: none;
  font-size: var(--mwai-fontSize);
}

.ac-chatbot-sources__header .ac-chatbot-side-panel__title {
  color: var(--mwai-headerColor);
  font-weight: 500;
  font-size: 14px;
  line-height: 32px;
  margin: 0;
}

.ac-chatbot-side-panel__title {
  min-width: 0;
  font-size: 14px;
  line-height: 1.2;
}

.ac-chatbot-side-panel__close {
  flex: 0 0 auto;
}

.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close) {
  position: absolute !important;
  top: 50%;
  right: 1rem;
  left: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  z-index: 12;
}

.mwai-close-button.ac-panel-close.ac-chatbot-history__close {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close)::before,
.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close)::after,
.mwai-close-button.ac-panel-close.ac-chatbot-history__close::before,
.mwai-close-button.ac-panel-close.ac-chatbot-history__close::after {
  content: " ";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.2px;
  height: 18px;
  margin-top: -9px;
  margin-left: -0.6px;
  background-color: #64748b;
  transition: transform 0.2s ease-out, background-color 0.2s ease-out;
}

.mwai-close-button.ac-panel-close.ac-chatbot-history__close::before {
  transform: rotate(45deg);
}

.mwai-close-button.ac-panel-close.ac-chatbot-history__close::after {
  transform: rotate(-45deg);
}

.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close)::before {
  transform: rotate(45deg);
}

.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close)::after {
  transform: rotate(-45deg);
}

.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close):hover::before,
.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close):focus-visible::before {
  transform: rotate(135deg);
  background-color: #0f172a;
}

.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close):hover::after,
.mwai-close-button.ac-panel-close.ac-chatbot-side-panel__close:not(.ac-chatbot-history__close):focus-visible::after {
  transform: rotate(45deg);
  background-color: #0f172a;
}

.mwai-close-button.ac-panel-close.ac-chatbot-history__close:hover::before,
.mwai-close-button.ac-panel-close.ac-chatbot-history__close:focus-visible::before {
  transform: rotate(135deg);
}

.mwai-close-button.ac-panel-close.ac-chatbot-history__close:hover::after,
.mwai-close-button.ac-panel-close.ac-chatbot-history__close:focus-visible::after {
  transform: rotate(45deg);
}

.ac-chatbot-sources__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  background: var(--mwai-conversationsBackgroundColor) !important;
}

.ac-chatbot-sources__empty {
  margin: 0;
  padding: var(--mwai-spacing);
  color: var(--mwai-fontColor);
  opacity: 0.65;
  font-size: var(--mwai-fontSize);
  line-height: 1.45;
}

.ac-chatbot-sources ul,
.ac-chatbot-sources ol {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.ac-chatbot-sources ul li,
.ac-chatbot-sources ol li {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  position: static !important;
  overflow: visible !important;
}

.ac-chatbot-sources ul li::before,
.ac-chatbot-sources ol li::before {
  content: none !important;
  display: none !important;
}

.ac-chatbot-sources__list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ac-chatbot-sources__item {
  position: relative;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
  color: var(--mwai-fontColor);
  transition: all 0.3s ease;
}

.ac-chatbot-sources__item:first-child {
  margin-top: calc(var(--mwai-spacing) / 2) !important;
}

.ac-chatbot-sources__item::before {
  content: none !important;
}

.ac-chatbot-sources__content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: transparent;
  padding: 10px 14px;
  margin: 4px 10px;
  border-radius: var(--mwai-borderRadius);
  transition: all 0.3s ease;
}

.ac-chatbot-sources__item:hover .ac-chatbot-sources__content {
  background: var(--mwai-backgroundAiColor);
  cursor: pointer;
}

.ac-chatbot-sources__icon {
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  object-fit: contain;
}

.ac-chatbot-sources__icon--fallback,
.ac-chatbot-sources__icon--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  font-size: 14px;
  color: var(--mwai-fontColor);
  opacity: 0.55;
}

.ac-chatbot-sources__icon--link svg {
  display: block;
  width: 16px;
  height: 16px;
}

.ac-chatbot-sources__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ac-chatbot-sources__link {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--mwai-fontColor) !important;
  font-size: var(--mwai-fontSize);
  font-weight: 500;
  text-decoration: none;
  word-break: break-word;
}

.ac-chatbot-sources__host {
  color: var(--mwai-fontColor);
  font-size: calc(var(--mwai-fontSize) * 0.85);
  line-height: 1.25;
  opacity: 0.55;
  word-break: break-word;
}

.ac-chatbot-sources__link:hover,
.ac-chatbot-sources__link:focus {
  color: var(--mwai-fontColor) !important;
  text-decoration: none;
}

.ac-chatbot-sources__label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--mwai-fontColor);
  font-size: var(--mwai-fontSize);
  font-weight: 500;
  word-break: break-word;
}

.ac-chatbot-sources__item--answer:hover .ac-chatbot-sources__content {
  cursor: default;
}

.ac-chatbot-sources__answer {
  flex: 1 1 auto;
  min-width: 0;
}

.ac-chatbot-sources__answer .ac-chatbot-sources__label {
  flex: none;
  margin-bottom: 4px;
}

.ac-chatbot-sources__excerpt {
  color: var(--mwai-fontColor);
  font-size: calc(var(--mwai-fontSize) * 0.95);
  font-weight: 400;
  line-height: 1.45;
  opacity: 0.92;
  white-space: pre-wrap;
  word-break: break-word;
}

.ac-chatbot-sources.is-fullscreen {
  z-index: 1000001;
  border-radius: 0;
  border-right: none;
  border-top: none;
  border-bottom: none;
}

.mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open.ac-with-sources,
#mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open.ac-with-sources {
  width: calc(100% - 288px) !important;
  max-width: calc(100% - 288px) !important;
}

.mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open.ac-with-history.ac-with-sources,
#mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open.ac-with-history.ac-with-sources {
  left: 268px !important;
  width: calc(100% - 556px) !important;
  max-width: calc(100% - 556px) !important;
}

/* Desktop maximized: keep chat + side panels above the fixed bottom bar */
@media (min-width: 1300px) {
  .mwai-popbot-theme.mwai-fullscreen.mwai-window.mwai-open,
  .mwai-timeless-theme.mwai-fullscreen.mwai-window.mwai-open,
  .mwai-messages-theme.mwai-fullscreen.mwai-window.mwai-open,
  .mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open,
  #mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open {
    top: 0 !important;
    bottom: 56px !important;
    height: calc(100% - 56px) !important;
    height: calc(100vh - 56px) !important;
    height: calc(100dvh - 56px) !important;
    max-height: calc(100dvh - 56px) !important;
  }

  body.admin-bar .mwai-popbot-theme.mwai-fullscreen.mwai-window.mwai-open,
  body.admin-bar .mwai-timeless-theme.mwai-fullscreen.mwai-window.mwai-open,
  body.admin-bar .mwai-messages-theme.mwai-fullscreen.mwai-window.mwai-open,
  body.admin-bar .mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open,
  body.admin-bar #mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open {
    top: 32px !important;
    bottom: 56px !important;
    height: calc(100% - 88px) !important;
    height: calc(100vh - 88px) !important;
    height: calc(100dvh - 88px) !important;
    max-height: calc(100dvh - 88px) !important;
  }

  @media screen and (max-width: 782px) {
    body.admin-bar .mwai-popbot-theme.mwai-fullscreen.mwai-window.mwai-open,
    body.admin-bar .mwai-timeless-theme.mwai-fullscreen.mwai-window.mwai-open,
    body.admin-bar .mwai-messages-theme.mwai-fullscreen.mwai-window.mwai-open,
    body.admin-bar .mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open,
    body.admin-bar #mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open {
      top: 46px !important;
      height: calc(100% - 102px) !important;
      height: calc(100vh - 102px) !important;
      height: calc(100dvh - 102px) !important;
      max-height: calc(100dvh - 102px) !important;
    }
  }
}

@media (max-width: 1299px) {
  .ac-chatbot-history,
  .ac-chatbot-sources,
  .mwai-window#mwai-chatbot-popbot .mwai-header .ac-history-toggle,
  #mwai-chatbot-popbot.mwai-window .mwai-header .ac-history-toggle,
  .mwai-window#mwai-chatbot-popbot .mwai-header .ac-sources-toggle,
  #mwai-chatbot-popbot.mwai-window .mwai-header .ac-sources-toggle {
    display: none !important;
  }
  #mwai-chatbot-popbot .mwai-custom-resize-handle {
    display: none !important;
  }

  /* Hide site bottom bar whenever chatbot is open on mobile/tablet */
  body.ac-chatbot-fullscreen #bottom-bar,
  body:has(#mwai-chatbot-popbot.mwai-open) #bottom-bar {
    display: none !important;
  }

  .mwai-popbot-theme.mwai-window.mwai-open,
  .mwai-messages-theme.mwai-window.mwai-open,
  .mwai-window#mwai-chatbot-popbot.mwai-open,
  #mwai-chatbot-popbot.mwai-window.mwai-open,
  .mwai-popbot-theme.mwai-fullscreen.mwai-window.mwai-open,
  .mwai-messages-theme.mwai-fullscreen.mwai-window.mwai-open,
  .mwai-window#mwai-chatbot-popbot.mwai-fullscreen.mwai-open,
  #mwai-chatbot-popbot.mwai-window.mwai-fullscreen.mwai-open {
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 1000020 !important;
  }
}
