.chat-notification-toast-stack {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(380px, calc(100vw - (var(--space-6) * 2)));
  pointer-events: none;
}

.chat-notification-toast {
  display: grid;
  grid-template-columns: var(--space-10) minmax(0, 1fr);
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  border: 1.5px solid var(--cp-accent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 93%, var(--content-1) 7%);
  color: var(--content-1);
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--cp-accent) 14%, transparent);
  pointer-events: auto;
  cursor: pointer;
  animation: chat-notification-toast-in var(--dur-base) var(--ease-out) both;
  transition: border-color var(--dur-micro) var(--ease-standard),
              box-shadow var(--dur-micro) var(--ease-standard),
              opacity var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
}

.chat-notification-toast:hover {
  border-color: var(--cp-accent);
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--cp-accent) 18%, transparent);
}

.chat-notification-toast:focus-visible {
  outline: none;
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--cp-accent) 14%, transparent), var(--focus-ring);
}

.chat-notification-toast.is-urgent {
  border-color: var(--cp-danger);
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--cp-danger) 14%, transparent);
}

.chat-notification-toast.is-urgent:hover,
.chat-notification-toast.is-urgent:focus-visible {
  border-color: var(--cp-danger);
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--cp-danger) 18%, transparent);
}

.chat-notification-toast.is-leaving {
  opacity: 0;
  transform: translateX(var(--space-5));
}

/* Final stretch of the 10s lifetime: fade until gone (hover pauses/restores). */
.chat-notification-toast.is-fading {
  opacity: 0;
  transition: opacity 1600ms var(--ease-standard);
}

.chat-notification-toast-avatar {
  display: grid;
  width: var(--space-10);
  height: var(--space-10);
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cp-accent) 24%, var(--border-1));
  border-radius: var(--radius-circle);
  background: var(--cp-accent-soft);
  color: var(--cp-accent-hover);
  font-size: var(--text-base);
  font-weight: var(--weight-black);
  line-height: 1;
}

.chat-notification-toast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-notification-toast-content {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.chat-notification-toast-head {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}

.chat-notification-toast-actor {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-notification-toast-close {
  display: inline-grid;
  flex: 0 0 var(--space-6);
  width: var(--space-6);
  height: var(--space-6);
  min-height: 0;
  place-items: center;
  margin: calc(var(--space-1) * -1) calc(var(--space-1) * -1) 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-circle);
  background: transparent;
  color: var(--content-3);
  font: inherit;
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
}

.chat-notification-toast-close:hover {
  background: var(--surface-hover);
  color: var(--content-1);
}

.chat-notification-toast-context,
.chat-notification-toast-preview,
.chat-notification-toast-time {
  margin: 0;
}

.chat-notification-toast-context {
  overflow: hidden;
  color: var(--content-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-notification-toast-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--content-1);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-notification-toast-time {
  color: var(--content-3);
  font-size: var(--text-xs);
  line-height: var(--leading-tight);
}

.chat-notification-toast.is-summary .chat-notification-toast-avatar {
  border-color: var(--border-1);
  background: var(--surface-3);
  color: var(--content-2);
}

@keyframes chat-notification-toast-in {
  from {
    opacity: 0;
    transform: translateY(var(--space-3)) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .chat-notification-toast-stack {
    right: var(--space-3);
    bottom: var(--space-3);
    width: calc(100vw - (var(--space-3) * 2));
  }
}

/* Mia, the AI teammate: her pink face with two eyes, as in Chat. */
.chat-notification-toast-avatar.is-agent-mia {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18%;
  border-color: transparent;
  border-radius: 38%;
  background: #e5488d;
}

.chat-notification-toast-avatar.is-agent-mia i {
  width: 13%;
  height: 30%;
  border-radius: 40%;
  background: #fff;
}
