.toast-v2-region {
  z-index: 1000;
  max-width: min(320px, calc(100vw - 64px));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.toast-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  column-gap: 12px;
  row-gap: 12px;
  width: 320px;
  max-width: 100%;
  padding: 12px;
  max-height: min(420px, calc(100dvh - 96px));
  overflow: hidden;
  pointer-events: auto;
  box-sizing: border-box;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 8px;
  color: var(--v2-text-text-base);
  background: var(--v2-background-bg-layer-01);
  box-shadow: var(--v2-elevation-floating);
  transition:
    transform 280ms cubic-bezier(0.2, 0, 0, 1),
    opacity 160ms ease-out,
    height 280ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 160ms ease-out;

  &:has(> [data-icon]) {
    grid-template-columns: 16px minmax(0, 1fr) 20px;
  }

  &:focus-visible {
    box-shadow:
      var(--v2-elevation-floating),
      0 0 0 2px var(--v2-border-border-focus);
  }

  &[data-expanded="true"] {
    overflow: visible;
  }

  &[data-expanded="false"][data-front="false"] > * {
    opacity: 0;
  }

  &[data-expanded="false"][data-front="false"] {
    --y: translateY(calc(-1 * var(--toasts-before) * 9.5px)) scale(calc(1 - var(--toasts-before) * 0.05));
  }

  > [data-icon] {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 20px;
    color: var(--v2-icon-icon-base);
  }

  > [data-content] {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
  }

  &:has(> [data-icon]) > [data-content] {
    grid-column: 2;
  }

  > [data-close-button] {
    grid-column: 2;
    grid-row: 1;
    position: static;
    align-self: start;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    transform: none;
    background: transparent;
    color: var(--v2-icon-icon-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  &:has(> [data-icon]) > [data-close-button] {
    grid-column: 3;
  }

  > [data-close-button]:hover {
    background: var(--v2-overlay-simple-overlay-hover);
    color: var(--v2-icon-icon-base);
  }

  > [data-close-button]:active {
    background: var(--v2-overlay-simple-overlay-pressed);
  }

  > [data-close-button]:focus-visible {
    outline: 2px solid var(--v2-border-border-focus);
    outline-offset: 2px;
  }

  > [data-icon] > *,
  > [data-icon] svg,
  > [data-close-button] svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
  }

  [data-title],
  [data-slot="toast-v2-title"] {
    color: var(--v2-text-text-base);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-style: normal;
    font-weight: 530;
    line-height: 20px;
    letter-spacing: -0.04px;
    font-synthesis: none;
    margin: 0;
  }

  [data-description],
  [data-slot="toast-v2-description"] {
    color: var(--v2-text-text-muted);
    text-wrap-style: pretty;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 13px;
    font-style: normal;
    font-weight: 440;
    line-height: 20px;
    letter-spacing: -0.04px;
    font-synthesis: none;
    margin: 0;
  }

  [data-slot="toast-v2-actions"] {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  &:has(> [data-icon]) [data-slot="toast-v2-actions"] {
    grid-column: 2;
  }

  [data-slot="toast-v2-actions"] [data-component="button-v2"] {
    min-height: 24px;
    font-size: 13px;
    font-style: normal;
    font-weight: 530;
    line-height: 20px;
    letter-spacing: -0.04px;
    font-synthesis: none;
  }

  [data-slot="toast-v2-header"] {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  [data-slot="toast-v2-icon"] {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 20px;
    color: var(--v2-icon-icon-base);
  }

  [data-slot="toast-v2-content"] {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast-v2,
  .toast-v2 > * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 600px) {
  .toast-v2-region {
    max-width: calc(100vw - 32px);
  }

  .toast-v2 {
    width: 100%;
  }
}
