/* System toasts WOW — remplacent #system-message-container inline */
#system-message-container.is-ms-harvested,
body.ms-toasts-ready #system-message-container {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}

.ms-toast-host {
  position: fixed;
  z-index: 10050;
  top: max(0.85rem, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 1.5rem));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.ms-toast {
  --ms-toast-accent: #0E9A96;
  --ms-toast-glow: rgba(14, 154, 150, 0.35);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.95rem 1rem 1.05rem;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, #fff 55%),
    radial-gradient(120% 100% at 0% 0%, var(--ms-toast-glow), transparent 55%);
  border: 1px solid rgba(10, 61, 74, 0.12);
  box-shadow:
    0 18px 40px rgba(10, 61, 74, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  color: #0A3D4A;
  animation: msToastIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ms-toast.is-leaving {
  animation: msToastOut 0.35s ease-in forwards;
}

.ms-toast.is-success {
  --ms-toast-accent: #1B7A4E;
  --ms-toast-glow: rgba(27, 122, 78, 0.28);
}

.ms-toast.is-warning,
.ms-toast.is-notice {
  --ms-toast-accent: #B45309;
  --ms-toast-glow: rgba(245, 158, 11, 0.32);
}

.ms-toast.is-error,
.ms-toast.is-danger {
  --ms-toast-accent: #DC2626;
  --ms-toast-glow: rgba(220, 38, 38, 0.28);
}

.ms-toast.is-info,
.ms-toast.is-message {
  --ms-toast-accent: #0E9A96;
  --ms-toast-glow: rgba(14, 154, 150, 0.3);
}

.ms-toast__icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  background: var(--ms-toast-accent);
  box-shadow: 0 8px 18px var(--ms-toast-glow);
  flex-shrink: 0;
}

.ms-toast__body {
  min-width: 0;
  padding-top: 0.15rem;
}

.ms-toast__title {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ms-toast-accent);
}

.ms-toast__text {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  color: #0A3D4A;
  word-break: break-word;
}

.ms-toast__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(10, 61, 74, 0.45);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ms-toast__close:hover,
.ms-toast__close:focus-visible {
  color: #0A3D4A;
  background: rgba(10, 61, 74, 0.08);
  outline: none;
}

.ms-toast__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(10, 61, 74, 0.08);
  overflow: hidden;
}

.ms-toast__progress > span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--ms-toast-accent);
  animation: msToastProgress linear forwards;
}

@keyframes msToastIn {
  from {
    opacity: 0;
    transform: translateY(-1.25rem) scale(0.94);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes msToastOut {
  to {
    opacity: 0;
    transform: translateY(-0.75rem) scale(0.96);
    filter: blur(2px);
  }
}

@keyframes msToastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 640px) {
  .ms-toast-host {
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    width: calc(100vw - 1rem);
  }

  .ms-toast {
    padding: 0.85rem 0.85rem 1rem;
    border-radius: 14px;
  }

  .ms-toast__text {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-toast,
  .ms-toast.is-leaving,
  .ms-toast__progress > span {
    animation: none !important;
  }
}
