/* The same control is used in the public help dialog and the builder chats. */
:is(#help-dialog.help-chat-dialog, .native-dialog, #webinku-studio-ai) button[data-chat-close] {
  --close-fill: #eee9f8;
  --close-border: #d8d0e3;
  --close-ink: #211b29;
  --close-ring: #7134bf;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--close-border);
  border-radius: 50%;
  background: var(--close-fill);
  color: var(--close-ink);
  line-height: 0;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

:is(#help-dialog.help-chat-dialog, .native-dialog, #webinku-studio-ai) button[data-chat-close] > svg {
  display: block;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

:is(#help-dialog.help-chat-dialog, .native-dialog, #webinku-studio-ai) button[data-chat-close]:focus-visible {
  outline: 2px solid transparent;
  outline-offset: -4px;
  box-shadow: inset 0 0 0 2px var(--close-ring);
}

html[data-theme="dark"] :is(.native-dialog, #webinku-studio-ai) button[data-chat-close] {
  --close-fill: #393241;
  --close-border: #665970;
  --close-ink: #faf8ff;
  --close-ring: #cea9ff;
}

/* A fresh chat starts at the named dialog. Tab moves to the close control. */
:is(#help-dialog.help-chat-dialog, .native-dialog.support-chat-dialog, .native-dialog.customer-ai-dialog):focus {
  outline: none;
}

#help-dialog.help-chat-dialog {
  padding-block-start: 56px;
}

#help-dialog.help-chat-dialog > button[data-chat-close] {
  top: 6px;
  inset-inline-start: auto;
  inset-inline-end: 12px;
}

@media (forced-colors: active) {
  :is(#help-dialog.help-chat-dialog, .native-dialog, #webinku-studio-ai) button[data-chat-close]:focus-visible {
    outline-color: Highlight;
  }
}
