.form-field {
  --form-field-blue: #139fe5;
  --form-field-danger: #fda4af;
  --form-field-text: #f7f3ff;
  --form-field-radius: 1.25rem;
  --form-field-inset:
    inset 5px 5px 12px #11121a,
    inset -4px -4px 10px rgb(56 59 77 / 35%);

  display: grid;
  gap: 0.65rem;
}

.form-field__label {
  color: #d9d5e4;
  font-size: 0.85rem;
  font-weight: 700;
}

.form-field__control {
  position: relative;
}

.form-field__input {
  width: 100%;
  min-height: 3.75rem;
  padding: 0 1.15rem;
  border: 1px solid rgb(255 255 255 / 5%);
  border-radius: var(--form-field-radius);
  outline: 0;
  background: #191b25;
  box-shadow: var(--form-field-inset);
  color: var(--form-field-text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.form-field__input::placeholder {
  color: #777587;
}

.form-field__input:focus-visible {
  border-color: var(--form-field-blue);
  box-shadow: var(--form-field-inset), 0 0 0 3px rgb(19 159 229 / 35%);
}

.form-field--invalid .form-field__input {
  border-color: var(--form-field-danger);
}

.form-field__error {
  margin: 0;
  color: var(--form-field-danger);
  font-size: 0.8rem;
  line-height: 1.45;
}

.form-field__errors {
  display: grid;
  gap: 0.25rem;
}

.form-field__visibility {
  position: absolute;
  top: 50%;
  right: 0.8rem;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 0.9rem;
  background: transparent;
  color: #a9a6b6;
  cursor: pointer;
  transform: translateY(-50%);
}

.form-field__visibility:focus-visible {
  outline: 3px solid rgb(19 159 229 / 55%);
  outline-offset: 2px;
}

.form-field__visibility i {
  width: 1.25rem;
  font-size: 1.25rem;
}

.form-errors {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgb(253 164 175 / 35%);
  border-radius: 1rem;
  background: #1c1e29;
  box-shadow: 6px 6px 14px #0d0e13, -4px -4px 12px rgb(51 54 70 / 30%);
  color: #fecdd3;
}

.form-errors h2 {
  margin: 0;
  font-size: 0.95rem;
}

.form-errors ul {
  margin: 0.65rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.55;
}

.ui-toast-region {
  position: fixed;
  z-index: 1000;
  top: 1.5rem;
  right: 1.5rem;
  display: grid;
  width: min(24rem, calc(100% - 2rem));
  gap: 1.25rem;
  pointer-events: none;
}

.ui-toast {
  --toast-accent: #38bdf8;
  --toast-delay: 0ms;
  --toast-duration: 6000ms;
  --toast-glow: rgb(14 165 233 / 40%);

  position: relative;
  display: flex;
  width: 100%;
  padding: 1.25rem;
  gap: 1rem;
  align-items: flex-start;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 2%);
  border-radius: 1.5rem;
  background: #1c1f27;
  box-shadow:
    0 24px 48px -12px rgb(0 0 0 / 70%),
    inset 2px 2px 6px rgb(255 255 255 / 4%),
    inset -3px -3px 8px rgb(0 0 0 / 40%);
  color: #f1f5f9;
  pointer-events: auto;
  animation: ui-toast-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--toast-delay);
}

.ui-toast::before {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 0.25rem;
  background: rgb(0 0 0 / 30%);
  content: "";
}

.ui-toast--success {
  --toast-accent: #34d399;
  --toast-glow: rgb(16 185 129 / 40%);
}

.ui-toast--error {
  --toast-accent: #fb7185;
  --toast-glow: rgb(244 63 94 / 40%);
}

.ui-toast--warning {
  --toast-accent: #fbbf24;
  --toast-glow: rgb(245 158 11 / 40%);
}

.ui-toast--info {
  --toast-accent: #38bdf8;
  --toast-glow: rgb(14 165 233 / 40%);
}

.ui-toast--leaving {
  animation: ui-toast-exit 240ms ease-in forwards;
}

.ui-toast__icon {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #15171d;
  box-shadow:
    inset 3px 3px 6px rgb(0 0 0 / 60%),
    inset -2px -2px 4px rgb(255 255 255 / 3%);
  color: var(--toast-accent);
}

.ui-toast__icon i {
  font-size: 1.4rem;
}

.ui-toast__content {
  min-width: 0;
  padding-top: 0.125rem;
  flex: 1;
}

.ui-toast__title {
  margin: 0;
  color: rgb(255 255 255 / 90%);
  font-size: 0.875rem;
  font-weight: 600;
}

.ui-toast__message {
  margin: 0.25rem 0 0;
  color: rgb(255 255 255 / 42%);
  font-size: 0.75rem;
  line-height: 1.55;
}

.ui-toast__action {
  display: inline-flex;
  min-height: 2rem;
  margin-top: 1rem;
  padding: 0 1rem;
  align-items: center;
  border-radius: 999px;
  background: #232732;
  box-shadow:
    0 4px 10px -2px rgb(0 0 0 / 30%),
    inset 1px 1px 2px rgb(255 255 255 / 5%),
    inset -1px -1px 3px rgb(0 0 0 / 30%);
  color: rgb(255 255 255 / 90%);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

.ui-toast__action:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

.ui-toast__close {
  display: grid;
  width: 2rem;
  height: 2rem;
  margin: -0.2rem -0.35rem 0 0;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgb(255 255 255 / 22%);
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.ui-toast__close:hover {
  background: rgb(255 255 255 / 4%);
  color: rgb(255 255 255 / 65%);
}

.ui-toast__close:focus-visible,
.ui-toast__action:focus-visible {
  outline: 3px solid var(--toast-accent);
  outline-offset: 2px;
}

.ui-toast__progress {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0.25rem;
  border-radius: 0 999px 999px 0;
  background: var(--toast-accent);
  box-shadow: 0 0 10px var(--toast-glow);
  transform-origin: left;
  animation: ui-toast-progress var(--toast-duration) linear forwards;
  animation-delay: var(--toast-delay);
}

@keyframes ui-toast-enter {
  from {
    opacity: 0;
    transform: translate3d(2rem, 0, 0) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes ui-toast-exit {
  from {
    max-height: 12rem;
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    transform: translate3d(2rem, 0, 0) scale(0.96);
  }
}

@keyframes ui-toast-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 520px) {
  .ui-toast-region {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
  }

  .ui-toast {
    padding: 1rem;
    border-radius: 1.25rem;
  }
}

.clay-dialog-card {
  position: relative;
  padding: 1.5rem;
  border: 1px solid rgb(255 255 255 / 5%);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 2%), transparent 40%),
    #16181d;
  box-shadow:
    12px 12px 30px rgb(0 0 0 / 42%),
    -5px -5px 16px rgb(255 255 255 / 1.8%);
}

@media (min-width: 640px) {
  .clay-dialog-card {
    padding: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-field__input,
  .ui-toast,
  .ui-toast__progress,
  .ui-toast__action,
  .ui-toast__close {
    animation: none;
    transition: none;
  }
}
