.chat-dialog {
  &__backdrop {
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0, 0, 0, 45%);
    transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);

    &[data-starting-style],
    &[data-ending-style] {
      opacity: 0;
    }
  }

  &__viewport {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 24px;
    pointer-events: none;
  }

  &__popup {
    pointer-events: auto;
    box-sizing: border-box;
    width: min(100%, 420px);
    max-width: calc(100vw - 32px);
    padding: 24px;
    border-radius: 16px;
    background: var(--bg-color-operate, #fff);
    color: var(--text-color-primary, #111827);
    box-shadow:
      0 24px 48px rgba(15, 23, 42, 18%),
      0 8px 16px rgba(15, 23, 42, 12%);
    transition:
      opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 200ms cubic-bezier(0.16, 1, 0.3, 1);

    &[data-starting-style],
    &[data-ending-style] {
      opacity: 0;
      transform: translateY(8px) scale(0.96);
    }
  }

  &__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  &__header-main {
    flex: 1;
    min-width: 0;
  }

  &__title {
    margin: 0;
    color: var(--text-color-primary, #111827);
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
  }

  &__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-color-secondary, #6b7280);
    cursor: pointer;
    transition:
      background-color 0.2s ease,
      color 0.2s ease;

    &:hover {
      background: rgba(15, 23, 42, 6%);
      color: var(--text-color-primary, #111827);
    }
  }

  &__body {
    margin-top: 12px;
    font-size: 14px;
    line-height: 22px;
  }

  &__description {
    margin: 0;
    color: var(--text-color-secondary, #4b5563);
    font-size: 14px;
    line-height: 22px;
  }

  &__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
  }

  &__footer-button {
    border-radius: 999px;
    transition:
      background-color 0.2s ease,
      border-color 0.2s ease,
      color 0.2s ease,
      opacity 0.2s ease;

    &--primary {
      border: 1px solid transparent;
      background: var(--text-color-link, #0052d9);
      color: #fff;

      &:hover:not(:disabled, [data-disabled]) {
        background: color-mix(in srgb, var(--text-color-link, #0052d9) 90%, black);
      }
    }

    &--secondary {
      border: 1px solid var(--stroke-color-primary, #d1d5db);
      background: var(--bg-color-operate, #fff);
      color: var(--text-color-primary, #111827);

      &:hover:not(:disabled, [data-disabled]) {
        border-color: var(--stroke-color-secondary, #9ca3af);
      }
    }
  }

  @media (width <= 640px) {
    &__viewport {
      padding: 16px;
    }

    &__popup {
      width: 100%;
      max-width: 100%;
      padding: 20px;
      border-radius: 14px;
    }

    &__title {
      font-size: 18px;
      line-height: 26px;
    }

    &__footer {
      flex-direction: column-reverse;
    }
  }
}
