.portal-toast-stack {
  position: fixed;
  top: 16px;
  bottom: auto !important;
  left: auto;
  right: 16px;
  z-index: 220;
  display: grid;
  gap: 10px;
  width: min(92vw, 380px);
}

.portal-toast {
  --toast-accent: #38bdf8;
  --toast-bg: rgba(2, 10, 22, 0.9);
  --toast-border: rgba(56, 189, 248, 0.35);
  --toast-duration: 3600ms;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid var(--toast-border);
  background: linear-gradient(155deg, var(--toast-bg), rgba(15, 23, 42, 0.9));
  box-shadow: 0 20px 45px rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(8px);
  color: #e2e8f0;
  padding: 12px 12px 16px;
  position: relative;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.portal-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.portal-toast.is-closing {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

.portal-toast__icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #f8fafc;
  background: color-mix(in srgb, var(--toast-accent) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--toast-accent) 65%, transparent);
}

.portal-toast__content {
  min-width: 0;
}

.portal-toast__title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #f8fafc;
  margin: 0;
}

.portal-toast__message {
  margin: 2px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #cbd5e1;
  word-break: break-word;
}

.portal-toast__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.portal-toast__close:hover {
  color: #e2e8f0;
}

.portal-toast__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: color-mix(in srgb, var(--toast-accent) 30%, transparent);
  transform-origin: left;
  animation: portal-toast-progress var(--toast-duration) linear forwards;
}

.portal-toast--ok {
  --toast-accent: #22c55e;
  --toast-border: rgba(34, 197, 94, 0.4);
}

.portal-toast--err {
  --toast-accent: #ef4444;
  --toast-border: rgba(239, 68, 68, 0.42);
}

.portal-toast--warn {
  --toast-accent: #f59e0b;
  --toast-border: rgba(245, 158, 11, 0.45);
}

.portal-toast--info {
  --toast-accent: #38bdf8;
  --toast-border: rgba(56, 189, 248, 0.35);
}

@keyframes portal-toast-progress {
  to {
    transform: scaleX(0);
  }
}

/* Password visibility toggle */
.password-wrap {
  position: relative;
  display: block;
}

.password-wrap .field,
.password-wrap input {
  width: 100%;
  padding-right: 2.8rem;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.password-toggle-btn:hover {
  color: #e2e8f0;
}

.password-toggle-btn:focus-visible {
  outline: 2px solid rgba(50, 213, 255, 0.7);
  outline-offset: 2px;
  border-radius: 4px;
}
