.ai-page-tools {
  margin: 0 0 1rem;
  font-size: .7rem;
}

.ai-page-tools__control {
  width: 100%;
  min-height: 1.2rem;
  display: grid;
  grid-template-columns: 1fr 2rem;
  color: var(--md-default-fg-color);
  background: var(--md-code-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: .2rem;
}

.ai-page-tools__copy,
.ai-page-tools__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .35rem .55rem;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}

.ai-page-tools__copy {
  justify-content: flex-start;
  text-align: left;
}

.ai-page-tools__toggle {
  border-left: 1px solid var(--md-default-fg-color--lightest);
}

.ai-page-tools__control:hover,
.ai-page-tools__control:focus-within {
  border-color: var(--md-accent-fg-color);
}

.ai-page-tools__copy:hover,
.ai-page-tools__copy:focus-visible,
.ai-page-tools__toggle:hover,
.ai-page-tools__toggle:focus-visible {
  color: var(--md-accent-fg-color);
  outline: none;
}

.ai-page-tools__label,
.ai-page-tools__caret {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.ai-page-tools__icon {
  width: .85rem;
  height: .85rem;
  flex: 0 0 auto;
}

.ai-page-tools__caret svg {
  width: .65rem;
  height: .65rem;
  transition: transform .16s ease;
}

.ai-page-tools[data-open="true"] .ai-page-tools__caret svg {
  transform: rotate(180deg);
}

.ai-page-tools__menu {
  display: none;
  margin-top: .25rem;
  overflow: hidden;
  background: var(--md-code-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: .2rem;
  box-shadow: var(--md-shadow-z2);
}

.ai-page-tools[data-open="true"] .ai-page-tools__menu {
  display: block;
}

.ai-page-tools__item {
  width: 100%;
  min-height: 2rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .55rem;
  color: var(--md-default-fg-color);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
}

.ai-page-tools__item .ai-page-tools__icon:last-child {
  margin-left: auto;
}

.ai-page-tools__item + .ai-page-tools__item {
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.ai-page-tools__item:hover,
.ai-page-tools__item:focus-visible {
  color: var(--md-accent-fg-color);
  background: var(--md-default-fg-color--lightest);
  outline: none;
}

.ai-page-tools__status {
  margin-top: .3rem;
  color: var(--md-default-fg-color--light);
  font-size: .62rem;
  line-height: 1.35;
}

@media screen and (max-width: 76.1875em) {
  .ai-page-tools {
    display: none;
  }
}
